Forum Moderators: coopster & phranque

Message Too Old, No Replies

Net::FTP

Can't use perl module to FTP files

         

PhraSEOlogy

9:59 pm on Sep 25, 2003 (gmt 0)

10+ Year Member



I have a perl script that upload files from my server to another server. I can connect and login but when I try to "put" the files I get the error:

put failed User XXXXXXX logged in. Access restrictions apply.

I have write access to the directory but FTP wont allow it.

Any ideas folks?

MonkeeSage

3:47 am on Sep 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried it with a normal FTP client?

Jordan

timster

6:56 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you testing your progress along the way? I mean, adding:

or die "Cannot do xxxx ";

after each FTP command?

If an early step fails silently, the error on a later step can be confusing. If I had to bet, I'd say you didn't successfully change to the correct directory.

PhraSEOlogy

10:28 pm on Sep 26, 2003 (gmt 0)

10+ Year Member



Timster,

Yep I can 'pwd' 'cwd' but as soon as I issue the 'put' it throws a 'wobbly'.

I am trying to put to the web root - is there some restriction on doing that?

timster

2:20 am on Sep 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there a restriction *within Perl* for putting to the root? No; I tried it out just to be sure. Any such restriction would be on the server (and it might be).

Can you answer MonkeySage's question? Whether you can perform the task with an FTP client will help figure out the problem.

Also, can you tell us what you know about the server? Is it yours? What platform is it?

PhraSEOlogy

11:16 pm on Sep 29, 2003 (gmt 0)

10+ Year Member



Timster,

I am creating static html on a dedicated server in the US to feed a shared server in the UK. I can FTP the files using WS_FTP but when using Net::FTP is just complains.

Chris.

MonkeeSage

11:51 pm on Sep 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try Ryan Ware's ftp_mover script (you can find a copy here [unixreview.com], bottom of the page), and see if it works for you.

Jordan

[edit:] I wasn't very clear -- what I mean is, try his script locally and try putting something to the shared UK server with your username and pass you are using in your current script -- that way you'll know it's not a conflict between the Net::FTP module and the UK server, because his script uses Net::FTP; then the next place to look if it works would be at your current script and make sure you're doing the same things he does in his. [/edit]

PhraSEOlogy

3:10 pm on Sep 30, 2003 (gmt 0)

10+ Year Member



Thanks guys.

I will try the script.

Chris.

PhraSEOlogy

4:08 pm on Sep 30, 2003 (gmt 0)

10+ Year Member



Tried and it WORKED!

I was just being a dumb (something or other). I was using www.domain.co.uk to connect - which apparently worked to connect but would not allow me to issue ftp commands like "put".

Changed the www for ftp.domain.co.uk and "hey presto" I can now "put" files on the UK server. Many thanks for pointing me in the right direction!

Monkeysage - pretty cool little perl script - I will have to "assimilate" it into my own script. I just love those guys who write scripts and put in proper error checking - unlike an old quick'n'dirty hacker like me!

Chris.

Mohamed_E

6:57 pm on Oct 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Though the problem has been solved, I would like to make a suggestion additional to the suggestions made above to test everything.

I normally run my script with:

$ftp = Net::FTP->new($hostname{$host}, Debug => 0);

but as soon as things go wrong change the value of Debug from 0 to 1. Lots of output that may help identify the problem.

Of course this should be a command line option, but this works for me.