473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

can't read file send trough NET::FTP put

63
Hi, My goal is to put a file in a server trough ftp.
I'm using module Net::Ftp.
My code is simple (maybe too simple :-) )

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use Net::FTP;
  4.  
  5. my $ftp_host = 'ftp.tvnet.com.pt';
  6. my $ftp_user = 'estreias';
  7. my $ftp_pwd  = 'cinema';
  8.  
  9. my $ftp = Net::FTP->new($ftp_host, Debug => 0)
  10.       or die "Cannot connect to $ftp_host: $@";
  11.  
  12. # login::password
  13. $ftp->login($ftp_user,$ftp_pwd)
  14.       or die "Cannot login ", $ftp->message;
  15.  
  16. # file to transfer
  17. $ftp->put("/home/joao/Desktop/output.3gp")
  18.       or die "get failed ", $ftp->message;
  19.  
  20.  $ftp->quit;
This seems to work correctly and the file gets to the server.
The problems is that I can't open the file. I get errors like the file is corrupted or something like that for every file I try to send. I already tested video files (its what I need to send), but also text files and it doesn't work either.
If I put the same file in the ftp server with Filezilla, for example, it works fine.

Can someone give me some light here, please?

Thanks a lot,

Joćo
Oct 12 '07 #1
2 2630
numberwhun
3,509 Expert Mod 2GB
Hi, My goal is to put a file in a server trough ftp.
I'm using module Net::Ftp.
My code is simple (maybe too simple :-) )

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use Net::FTP;
  4.  
  5. my $ftp_host = 'ftp.tvnet.com.pt';
  6. my $ftp_user = 'estreias';
  7. my $ftp_pwd  = 'cinema';
  8.  
  9. my $ftp = Net::FTP->new($ftp_host, Debug => 0)
  10.       or die "Cannot connect to $ftp_host: $@";
  11.  
  12. # login::password
  13. $ftp->login($ftp_user,$ftp_pwd)
  14.       or die "Cannot login ", $ftp->message;
  15.  
  16. # file to transfer
  17. $ftp->put("/home/joao/Desktop/output.3gp")
  18.       or die "get failed ", $ftp->message;
  19.  
  20.  $ftp->quit;
This seems to work correctly and the file gets to the server.
The problems is that I can't open the file. I get errors like the file is corrupted or something like that for every file I try to send. I already tested video files (its what I need to send), but also text files and it doesn't work either.
If I put the same file in the ftp server with Filezilla, for example, it works fine.

Can someone give me some light here, please?

Thanks a lot,

Joćo
I would check as to whether or not this is doing a binary send or not. If it is not, change it to do so.

Regards,

Jeff
Oct 12 '07 #2
jcor
63
Your suggest was correct, I only add this line - $ftp -> binary; - to my code and it started working.

Thanks a lot again
Oct 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Carlo Filippini | last post by:
Hi I am trying to measure the perofrmance of a wireless link using maily ftp. Unfortunately get and put from Net::FTP do not give me an measure of the performances. I am sure somebody must have...
1
by: Mike John | last post by:
I want to write to text file, the follow text " My Name Is mike" Now, I have used the following sysntax: dim strFilePath as string = "C:\" dim strFileName as string = "MyFile.txt" ...
4
by: Maziar Aflatoun | last post by:
Hi, Is it possible to redirect users to an FTP server from your site without actually displaying the FTP username/password? Are there other alternatives? Currently, I have it so that once I...
9
by: craig.overton | last post by:
All, I am currently developing an FTP class in VB.NET. It's kid tested, mother approved when trying to access an FTP Server on a Windows box meaning I can connect, run commands, upload and...
5
by: a | last post by:
Hi, If I want to write a FTP client, which class should I use to perform the FTP? Can I use HTTP to transfer file as well? How to do this by VB .NET Thanks
1
by: Ben Kim | last post by:
Hello all, We are connecting to a remote server using FTP and sending up 100's of files daily to this site. I just received a call from the operations manager of this site and they are...
1
by: vasikaran | last post by:
i am doing ftp process in batch file i.e .bat file when the multiple file transfering from one server to another there may be some failure of file transfer i need to create logfile for failure...
0
by: Roy | last post by:
Hello, I got the following code from here thanks to the Access experts.I want to download and upload files from/to a FTP site. The upload code works without any problems: Sub...
3
dmjpro
by: dmjpro | last post by:
I tried a lot ... .But i didn't find any. Please Help! :-)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.