in reply to Trouble Uploading Word Doc and JPG
- In your final loop, you are printing to OUTFILE, when you need to print to OUTFILE2.
- As eXile noted, on Win32, you *do* need to binmode any filehandles on non-text files to prevent corruption or truncation.
- As eXile noted, you need open your output files in truncate (>) mode. You are getting away with using append (>>) mode only because you first die if the directory exists. Fix this, or it will bite you someday.
- While you are at it, change to the three-argument form of open. Someday you might receive a filename that interacts poorly with your current "magic open".
- You should add 'or die' to your close statements on the output files, in case your filesystem fills up.