Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Beating the system

by rbi (Monk)
on Sep 30, 2002 at 10:40 UTC ( [id://201673]=note: print w/replies, xml ) Need Help??


in reply to Beating the system

I put here some stuff that I use to get uploaded files, it does not run as it is here posted, but it may give you some ideas, hopefully.
Have you read about uploading files in the CGI.pm documentation? I started from Lincoln's Stein examples and it works pretty fine, no matter the size of the file to upload.
################ sub upload_files { ################ do_upload_prompt(); do_upload_work(); } #################### sub do_upload_prompt { #################### # This routine prompts for the upload of new files. # it uses CGI.pm, $myself is the name of the cgi script # Start a multipart form. print $query->start_multipart_form(-action=>"$myself"), filefield(-name=>'uploaded_file', -size=>30), br(), reset, submit(-label=>'Upload'), end_form; } } ################## sub do_upload_work { ################## my $tmppool = '/home/dummy/tmp/' my $filename_server; my $filename_client; my $filename_tmp; # Process the form if there is a file name entered # Get the name of the uploaded file on server, if it exits my $filename_client = $query->upload('uploaded_file'); # In case a file was indicated for upload, proceed if ($filename_client) { # Chech that the name is UNIX-compatible # Remove path from filename, if any (Internet Explorer keeps the path. +.) $filename_server = $filename_client; $filename_server =~ s(^.*\\)(); # Windows $filename_server =~ s(^.*/)(); # Unix # Make filename lowercase $filename_server=lc($filename_server); # Chech that the name is compatible for your purposes # get temporary filename $filename_tmp = $query->tmpFileName($file); # copy temporary file to the destination directory system "$CP $filename_tmp $tmppool$filename_srv"; } }
Please note the operation on file name to remove the path on the client. Under Internet Explorer it is kept together with the file name.
Regards, Roberto

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://201673]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-20 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found