okay this is wired! I GET THE SAME result with that script you showed me - ummm this HAS to be something my servers doing?? any suggestions??
| [reply] |
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.
| [reply] [d/l] [select] |
This is the response I get from the snip you posted:
$upload_dir = [images-user]
$filename = [20150608_144833.jpg]
$upload_dir/$filename = [images-user/20150608_144833.jpg]
it looks right! Again like i said I can see the file being created in the directory. I have two monitors and i have the DIR open on one and i hit submit in the other. the script goes through its thing - returns the correct page, the file is created but its like there no data IN the file. grrrr :) | [reply] [d/l] |
Thanks mate! i posted the form above, but i will try using your version and see if i get the same result - then at least i know its my server - not my code hehehe
| [reply] |
To be fair, even if you change the framework, it is always possible -- I would even go so far as to say "likely" -- that you would replicate a logic error (or a typo, like, say, neglecting to double your backslashes inside a quoted string) in the part of the code you have to supply to make a snippet like that work. It seems like changing the framework and getting the same error would implicate the site, but that's not as sure a bet as you'd think. :-)
| [reply] [d/l] |