Okay along the same lines - as mu last question. Now i need to change the file name upon UPLOAD.
for example:
if the file name the user selects in the form tag QUESTION-IMAGE is say example01.gif - while using the following code:
I need to rename the file upon upload to: $NEW::FILENAME. Wich in this example we will say is $NEW::FILENAME = "123456";
1: my $filename = $query->param('QUESTION-IMAGE');
2: my $upload_dir = "images/senario";
3: $filename =~ s/.*[\/\\](.*)/$1/;
4: my $upload_filehandle = $query->upload("QUESTION-IMAGE");
5:
6: open UPLOADFILE, ">$upload_dir/$filename";
7: binmode UPLOADFILE; # File IS binnary
8: while ( <$upload_filehandle> )
9: { print UPLOADFILE; }
10: close UPLOADFILE;
11: print $query->header ( );
Ive tried changing line 3 to $filename = $NEW::FILENAME but it dosnt seem to work.
Thanks in advance.
- Scott
Wise men ask questions, only fools keep quite.
for example:
if the file name the user selects in the form tag QUESTION-IMAGE is say example01.gif - while using the following code:
I need to rename the file upon upload to: $NEW::FILENAME. Wich in this example we will say is $NEW::FILENAME = "123456";
1: my $filename = $query->param('QUESTION-IMAGE');
2: my $upload_dir = "images/senario";
3: $filename =~ s/.*[\/\\](.*)/$1/;
4: my $upload_filehandle = $query->upload("QUESTION-IMAGE");
5:
6: open UPLOADFILE, ">$upload_dir/$filename";
7: binmode UPLOADFILE; # File IS binnary
8: while ( <$upload_filehandle> )
9: { print UPLOADFILE; }
10: close UPLOADFILE;
11: print $query->header ( );
Ive tried changing line 3 to $filename = $NEW::FILENAME but it dosnt seem to work.
Thanks in advance.
- Scott
Wise men ask questions, only fools keep quite.