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

I've figured out how to make an ftp connection, read the filenames in a particular directory, and display them.

I have a file on my hard drive: xxx.pdf. I want to copy that file onto my server.

Purpose for doing this is so a web page can attach that file to an email using perl. I've already figured out how to do that but it requires the file to be on the server.

Hope my question is clear.

Replies are listed 'Best First'.
Re: ftp a file
by Marshall (Canon) on Oct 04, 2010 at 19:14 UTC
    Sounds like you have figured out how to use Net::FTP.
    Put() and get() transfer files. you probably also want to set binmode.
    Can you explain what you've tried and what errors you are getting? As well as what you are using to read the remote directory. Are you sure you have write access to the remote directory?

    Update: I looked back again at this and "no, your question is not at all clear".
    Usually the hardest part of this is getting the connection established (firewall, proxy problems), getting authenticated and running a command on the remote machine (like tell me the files in the remote server's directory). You say that you can do all of those things (send and receive messages to/from the remote server, authenticate as a valid user and run commands like 'ls' on the server whose results are sent to you). Given that, I am completely mystified as to why you can't just put() a file. Can you transfer a file manually with say, FireFTP a Firefox add-in?

Re: ftp a file
by morgon (Priest) on Oct 04, 2010 at 22:18 UTC
    If the perl-script runs on the server you get to (ftp-) get it.

    If the perl-script runs on your local machine you have to (ftp-) put it.