Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: uploading a file to an FTP site

by sierrathedog04 (Hermit)
on Mar 22, 2001 at 04:38 UTC ( #66199=note: print w/replies, xml ) Need Help??


in reply to uploading a file to an FTP site

My interpretation of Apterigo's problem is that he does not need to use ftp. He could simply use the file upload feature of CGI.pm which is built into modern versions of Perl. This type of file upload uses http, not ftp.

Once the file is uploaded his form handler can test to see if the uploaded file is binary, move it based on the file type, and so on. The CGI.pm documentation provides the following example of how to move an uploaded file:

# Copy a binary file to somewhere safe open (OUTFILE,">>/usr/local/web/users/feedback"); while ($bytesread=read($filename,$buffer,1024)) { print OUTFILE $buffer; }

I have never used Net::FTP, but I suspect its use would be overkill in a case where ftp is not required.

Replies are listed 'Best First'.
Re: Re: uploading a file to an FTP site
by dvergin (Monsignor) on Mar 22, 2001 at 05:14 UTC
    Hey, sierrathedog04, nice take on using an easily-missed feature of CGI.pm. On the other hand, if the program is not already using CGI.pm, using it just for this introduces more overhead than necessary for a simple task. In that case, I'd use Net::FTP.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2022-10-06 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (26 votes). Check out past polls.

    Notices?