Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: CRC Error on ZIP Files

by hazylife (Monk)
on Mar 11, 2014 at 21:14 UTC ( [id://1077905]=note: print w/replies, xml ) Need Help??


in reply to Re^4: CRC Error on ZIP Files
in thread CRC Error on ZIP Files

What happens if you comment out unless (eof()) { chomp($bytes) } and the call to heimat()?

Replies are listed 'Best First'.
Re^6: CRC Error on ZIP Files
by SearchigPerl (Acolyte) on Mar 11, 2014 at 22:59 UTC
    Hi Hazylife,
    I checked according to your suggestion. Results are :
    whether "heimat" is getting called or not, doesn't make a difference.

    when commenting out the eof check everything is running fine, as long as the
    amount of data downloaded does not exceed the buffer's size, regardless whether
    there are one to two files. The very moment the data is more than
    the buffers size (again no matter whether due to the size of one file or due to
    the number of files) I end up with a corrupted file amoung the files transported
    The last file transported ( a jpeg) is showing only half of the original
    Any clues ?

      whether due to the size of one file or due to the number of files
      "the number of files" - as in "the number of files within the archive", right? Because download() only handles one file at a time.
      Any clues ?
      Come to think of it, this could be a server configuration issue (google "mod_gzip" OR "mod_deflate" zip corruption). What happens if you put a (preferably large) ZIP archive somewhere within the document root and download it using the direct link?

      Well, anyway, try this slightly modified version of download:

      sub download { my $filename = $_[0].$_[1]; use CGI; $html=new CGI; $| = 1; print $html->header( -type => 'application/zip', -charset => 'binary', -attachment => $_[1], -Content_length => -s $filename); open($peunter, "<", $filename); binmode($peunter); binmode STDOUT; while (read($peunter,$bytes,1024)) { print $bytes; } close($peunter); }
        Yes, as in "the number of files in the archive".
        I'll check the direct link and your code during the weekend, as I am
        currently traveling with limited bandwidth of my internet connection.

        Cheers

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found