Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to download zip file from FTP

Posted on 2009-05-04
8
Medium Priority
?
391 Views
Last Modified: 2012-05-06
Hi How to download zip file from FTP i have use code below:

$ftp->get("remote","local")or $newerr=1;


I successfully download the zip file but failed to open it.

i get error message below:

zip file corrupt, possible cause: file transfer error.
0
Comment
Question by:tankergoblin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 25

Expert Comment

by:lwadwell
ID: 24301785
Hi tankergoblin,

Are you using Net::FTP?  If so, are you ensuring the transfer is in binary mode first?  $ftp->binary;

lwadwell
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24301802
yes im using net::FTP
where should i put  $ftp->binary;, above $ftp->get?

like this???

$ftp=Net::FTP->new
$ftp->login
$ftp->cwd
@files2=$ftp->ls
****$ftp->binary
$ftp->get
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24301806
do i need to add anything to $ftp->binary
like $ftp->binary(...)??
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:tankergoblin
ID: 24301823
Mind to tell me how to extract a zip file??
0
 
LVL 25

Accepted Solution

by:
lwadwell earned 2000 total points
ID: 24301852
tankergoblin,

Yes, the $ftp->binary should be above the $ftp->get;  Transfers will be ascii by default - which is great for text file where you want the line terminators converted and some other special characters.  But for files like .zip ... you need to transfer it exactly without any translations, hence do it as binary.

No the $ftp->binary; requires no arguments - just use like that.

On what type of platform do you want to extract the file and do you have any zip tools installed (e.g on Windows - winzip or 7zip or pkzip or ... there probably hundreds of different ones).


lwadwell
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24301885
Im using Winzip and i use 'use Archive::Zip;' in perl
0
 
LVL 7

Author Comment

by:tankergoblin
ID: 24301891
on windows pc i would like to extract the file
0
 
LVL 25

Expert Comment

by:lwadwell
ID: 24301921
tankergoblin,

with WinZip - generally you can right click on the .zip file and an option to extract files should appear in the menu (I do not use WinZip myself).

with Archive::Zip - this can extract files but this generally used to create zip files.  It is recommended to use Archive::Extract instead.  I have never programmed with either but the help pages look simple enough.

lwadwell
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question