in reply to File upload with empty temp handle value
Please do not let random uploaders from the outside give files names on your system.
Ideally, you save the uploaded data to a file using a random name (or simply a number) and store the uploaded filename in a database together with the local name on your filesystem.
The actual filename of your temporary upload file is available through the ->upload() and ->tmpFileName methods. But the CGI documentation shows their usage different from what you do:
my $filehandle = $q->upload( 'uploaded_file' ); my $tmpfilename = $q->tmpFileName( $filehandle );
Maybe if you adapt your code to use the functions as in the documentation it will work better?
Personally, I would use File::Copy to copy data from the /tmp directory instead of hoping that rename will work.
Maybe you will also find Text::CleanFragment helpful, which converts arbitrary text to ASCII without spaces, which is mostly harmless to use in filenames.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File upload with empty temp handle value
by Anonymous Monk on Jan 15, 2018 at 19:46 UTC | |
by Corion (Patriarch) on Jan 15, 2018 at 20:09 UTC |