Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm using this code#!/usr/bin/perl use strict ; use warnings ; use CGI ; use Net::FTP; my $cgi = CGI->new(); ... my $file_name = $cgi->param( 'doc' ) || ''; $cgi->upload( 'doc_upload' ); # Can I alter where the file is temporally written here? my $tmp_file = $cgi->tmpFileName( $file_name );
to print what I am trying to rename to and I found that the "$tmp_file" is empty.warn qq{rename ("$tmp_file", "temp/$file_renamed");\n}; if (!rename("$tmp_file", "temp/$file_renamed" )) { warn $!, "\n"; } chmod 0664, "tmp/$file_renamed"; # Error: #Cannot open Local file doc1.txt: No such file or directory
When it should be printing something like this:rename ("", doc1.txt");
I hope I could explain what is happening with the code and thanks a lot for looking at it!!!... #my $put_file = $ftp->put("$file_renamed") or die "Cannot put file ", +$ftp->message; ... Error : Cannot put file The system cannot find the file specified.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File upload with empty temp handle value
by Corion (Patriarch) on Jan 15, 2018 at 19:34 UTC | |
by Anonymous Monk on Jan 15, 2018 at 19:46 UTC | |
by Corion (Patriarch) on Jan 15, 2018 at 20:09 UTC |