Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Net::FTP

by footbinc (Initiate)
on Jul 13, 2001 at 21:55 UTC ( #96498=perlquestion: print w/replies, xml ) Need Help??

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

Im having a small problem with Net:FTP
my $ftp=Net::FTP -> new($hostname) or die ("Connect failed"); my $filename=$wrname; print "Connected to Website\n"; $ftp->login($user,$password) or die ("cant Login"); $ftp->binary or die ("cant Binary"); $ftp->hash or die ("cant Hash"); $ftp->cwd("public_html") or die ("cant Change Dir"); $ftp->cwd("jobs") or die ("cant Change Dir2"); $ftp->put($filename) or die ("cant Upload"); print "File Uploaded"; $ftp->quit;
This keeps returing a error, Bad Remote File Name <name of file>. Any ideas?

Replies are listed 'Best First'.
Re: Net::FTP
by mikeB (Friar) on Jul 13, 2001 at 22:02 UTC
    Your $filename probably contains characters which are not valid in filenames on the remote system. This is common when going between Windows, Mac OS, and Unix systems. Some common offenders are -+\/:, and multiple .'s.
Re: Net::FTP
by princepawn (Parson) on Jul 13, 2001 at 22:04 UTC
    perl-libnet@perl.org may offer more help.

    You could start by using Debug => 1 in your constructor so we can see just where the error is being thrown.

Re: Net::FTP
by footbinc (Initiate) on Jul 13, 2001 at 22:16 UTC
    OK, i got it uploading using the following code:
    print "Connected to Website\n"; $ftp->login($user,$password) or die ("cant Login"); $ftp->binary or die ("cant Binary"); $ftp->hash or die ("cant Hash"); $ftp->cwd("public_html") or die ("cant Change Dir"); $ftp->cwd("jobs") or die ("cant Change Dir2"); $ftp->put("temp.html") or die ("cant Upload"); $ftp->rename("temp.html", $wrname) or die ("Cant Rename"); print "File Uploaded"; $ftp->quit;
    But now it adds a space to the end of the file, so the file for example is named "test.html " instead of "test.html"
      see chomp to fix that problem
Re: Net::FTP
by RhetTbull (Curate) on Jul 16, 2001 at 09:54 UTC
    I know there was a small bug in an older version of Net::FTP that would give that error if there was a space in the filename. See my node titled Spaces in file names with Net::FTP for a little more background. It might be worth checking to see if you're running a recent version of Net::FTP. Unfortunately I don't remember the version number related to this particular issue.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2022-05-23 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?