Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

uploading a file to an FTP site

by Apterigo (Scribe)
on Mar 22, 2001 at 02:06 UTC ( #66156=perlquestion: print w/replies, xml ) Need Help??

Apterigo has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks, I am looking to write a perl script that would upload two files to a web server, one that is binary, and one that is ascii, both into seperate directories. I am certain there is a module for this, but I need to be pointed in the right direction. Could someone please help?


Replies are listed 'Best First'.
Re: uploading a file to an FTP site
by TrinityInfinity (Scribe) on Mar 22, 2001 at 02:10 UTC
    There's a module that may work for you called Net::FTP. Hope it's what you're looking for...
Re: uploading a file to an FTP site
by wardk (Deacon) on Mar 22, 2001 at 03:48 UTC
Re: uploading a file to an FTP site
by sierrathedog04 (Hermit) on Mar 22, 2001 at 04:38 UTC
    My interpretation of Apterigo's problem is that he does not need to use ftp. He could simply use the file upload feature of 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 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.

      Hey, sierrathedog04, nice take on using an easily-missed feature of On the other hand, if the program is not already using, using it just for this introduces more overhead than necessary for a simple task. In that case, I'd use Net::FTP.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://66156]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2023-09-25 14:19 GMT
Find Nodes?
    Voting Booth?

    No recent polls found