I suspect you will have found it upon re-reading the thread, but just in case, see my reply above at Re^5: File Upload On Windows 8 and Perl.
Further note, you seem to be mixing slashes and backslashes in your filename -- I'm a stickler for consistency, admittedly often beyond what is needed, but experience has taught me that computers and inconsistency mix badly at times.
Finally, if adjusting the filename string the way you think you should doesn't fix the issue, you might consider having the script display its values to the browser before initiating the actual upload, just to make sure there isn't something else amiss. Input filename, output filename -- anything that could matter. Do not fall again for the trap of presuming to know what does matter. When stuff is broken, it pays to be extremely circumspect.
print "Content-Type: text/html\n\n";
print "<!DOCTYPE html>\n";
print "<html>\n";
print " <head>\n";
print " <title>My CGI File Upload Test</title>\n";
print " </head>\n";
print " <body>\n";
print " <p>\n";
print "\$upload_dir = [$upload_dir]<br />\n";
print "\$filename = [$filename]<br />\n";
print "\$upload_dir/\$filename = [$upload_dir\/$filename]<br />\n"
+;
print " </p>\n";
Another tidbit I ran into from my own experiences -- if the server is a Windows server, sometimes they don't set permissions on TEMPthe way you'd expect, and the CGI uploader temporarily writes there. Total upload failure if you don't have write permissions to the TEMPdirectory. A workaround is to establish a different directory for it to work with as its workspace:
# Needed to avoid dependence on C:\TEMP being world read+write
BEGIN { $TempFile::TMPDIRECTORY = './'; }
It's been my experience that using './'for $TempFile::TMPDIRECTORYtends to result in the cgi-binor similar directory being used -- but it depends on where your Perl CGI script lives -- in your case, I seem to recall your form invokes it from /test/, so make sure your script has write permission there, or change the value used for $TempFile::TMPDIRECTORY.
|