in reply to Re^2: FileParse is NOT working correctly
in thread FileParse is NOT working correctly
The file name appears to have underscores after it is retrieved from the form
So you're saying the path already has the underscores when you print out $FileName right after this(?):
# Get the attachment $FileName = $query->param('FileName');
If so, it's no surprise fileparse() has issues with it. In this case, the next step would be to investigate what the browser actually sends...
One general debugging rule is to reduce the case to the smallest piece of code that does exhibit the problem. Why look at the mailing code when the problem is with parsing the filename? Remove everything that likely is unrelated. If the problem persists, it was unrelated. Otherwise, take the code back in stepwise until the problem reappears... Also, always verify implicit assumptions. I.e. if you suspect that fileparse() is doing something wrong, you're implicitly assuming it's getting proper input. Verify it, print it out. That way, you can usually narrow down rather quickly on where things are going wrong...
And if you haven't found the error yourself by then, you've at least produced a small (and hopefully self-contained) piece of code which would allow others to reproduce the issue.
|
|---|