I certainly agree that you should do taint-checking on the name of the file the users sends you... A simple open UPLOADFILE, ">$upload_dir/$file" could corrupt data depending on the application, and the configuration of the webserver. (even worse would be chdir $upload_dir;open UPLOADFILE, ">$file";
In my opinion you should ALWAYS use the three arguments version of open (something like: open UF, ">", "$upload_dir/$filename" or die $!). , since this does not allow a mode change... (and a mode change could corrupt one of your files and/or your script's configuration file (wihtout knowing the file's name that is, but that depends on the script), and/or running files (but only when there is no mode, in case this this is impossible since you have ">"))
As a side note: the OP's code does not need 64kb of data to work, 'read' will try to read a maximum of 64kb of data. (which is quite different)
In reply to Re^2: File uploading methods compared
by Animator
in thread File uploading methods compared
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |