4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 19, 2018, 10:08:42 PM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Issues / Ausgaben
| |-+  Discussion & Troubleshooting (Moderators: Acidgod, ivan, Rembrandt)
| | |-+  Fixed! Thanks V@nо! -- Was: 1.7.7 - .zip file downloads corrupt
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Fixed! Thanks V@nо! -- Was: 1.7.7 - .zip file downloads corrupt  (Read 26112 times)
siredgar
Pre-Newbie

Offline Offline

Posts: 7

Thank You
-Given: 0
-Receive: 0


View Profile
« on: September 21, 2009, 10:37:04 PM »

I have a brand new installation of 1.    7.    7 at
1
http://files.arcadecontrols.com/

(First, a thank you to the authors and everyone who has helped on the forums.     Any problems or desires I've had I've been able to figure out by reading other posts.     Thanks!)

I have a problem with .    zip files.     Most (but not all) of the zip files on my server will not download properly.     They are corrupt when downloaded.     However, when I look at them on the server the .    zip file is not corrupt.     If you directly download the file using http the file is not corrupt.     If you download the same file from the download.    php 4images script, the file is corrupt.     

All files are stored locally, there are no remote files.     I am not using the zip download button, I am using the standard download button.     The files are previously zipped before being uploaded to my server.     Here I have a few examples:


File: mrotate2.    zip -- in the "Miscellaneous" category, which is directory number 27.     Actual file name on disk is setup.    zip.     403kb
1
2
3
URL: http://files.arcadecontrols.com/details.php?image_id=3431
4images script download link: http://files.arcadecontrols.com/download.php?image_id=3431
Direct download link: http://files.arcadecontrols.com/data/media/27/setup.zip
=========
Using the 4images download.    php script, the file is corrupt
using the direct link, the file is not corrupt
Both links use the http protocol, not FTP.   


File: multipac.    zip -- in the "Arcade Manuals and Schematics" category, which is directory number 4.     Actual file name on disk is multipac.    zip.     500Kb.   
1
2
3
URL: http://files.arcadecontrols.com/details.php?image_id=2426
4images script download link: http://files.arcadecontrols.com/download.php?image_id=2426
Direct download link: http://files.arcadecontrols.com/data/media/4/multipac.zip
===========
Using the 4images download.    php script, the file is corrupt
Using the direct link, the file is not corrupt
Both links use the http protocol, not FTP.   


Strangely enough, the following zip file works properly.   

File: sinistar-paint-codes.    zip -- in the "Paint Codes" category, which is directory number 14.     Actual file name is sinistar-paint-codes.    zip.     8.    8Kb.   
1
2
3
URL: http://files.arcadecontrols.com/details.php?image_id=3430
4images script download link: http://files.arcadecontrols.com/download.php?image_id=3430
Direct down load link: http://files.arcadecontrols.com/data/media/14/sinistar-paint-codes.zip
===========
Using the 4images download.    php script, the file is not corrupt
Using the direct link, the file is not corrupt
Both links use the http protocol, not FTP.   


--------------------------------

I thought maybe file size was a factor, but the following two tests don't seem to really agree:

File: logo.    zip - 13Kb
1
2
download.php download: http://files.arcadecontrols.com/download.php?image_id=3485 = corrupt
direct download: http://files.arcadecontrols.com/data/media/27/logo.zip = working


File: test2.    zip - 189b
1
2
download.php download: http://files.arcadecontrols.com/download.php?image_id=3483 = working
direct download: http://files.arcadecontrols.com/data/media/27/test2.zip = working
----------------------------------------------------
----------------------------------------------------

So I am at a loss.     Any suggestions or tips? Help is much appreciated!

--- John St.    Clair
    Build Your Own Arcade Controls

« Last Edit: September 22, 2009, 04:51:45 AM by siredgar » Logged
V@nо
Addicted member
******
Offline Offline

Posts: 1223

Thank You
-Given: 11
-Receive: 17


View Profile
« Reply #1 on: September 21, 2009, 10:42:50 PM »

try open corrupted file in notepad.
Logged

Your first three "must do" before you ask a question:
If I asked you to PM me, I meant PM to my primary account, this account doesn't accept PMs.
siredgar
Pre-Newbie

Offline Offline

Posts: 7

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: September 22, 2009, 01:38:49 AM »

Quote from: V@nо link=topic=25893. msg141169#msg141169 date=1253565770   [Expand]
try open corrupted file in notepad.

I did open one in notepad.  The header looked OK to me:
1
2
3
PK    Ȁ5;Qע2  3     logo.gifPM !!$5"`@ޑ^ Q (AB/*h( h Am b{?o+s3;gima`_
:  04ZPDȊJ*ʪʪYU-CZEUP됡YCC#s&65>?J
'k)ZC<0br(P!b

The footer looked like this:

1
*j^lo2cLMoͿhPK     Ȁ5;Qע2  3                   logo.

So I don't see anything obvious being added to the front/back of the file.
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #3 on: September 22, 2009, 02:20:19 AM »

interesting, the corrupted files are missing 25 bytes at the end...
is gzip compression turned on  on your server (see zlib.output_compression in phpinfo in ACP) or in 4images itself (see "Use GZip compression" in settings)?

I just double checked download.php and couldn't find anything that could possible cause this. it uses PHP's built in functions filesize() to detect filesize and readfile() to read and output file's content...At this point all I could suspect is it's server related issue...
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
siredgar
Pre-Newbie

Offline Offline

Posts: 7

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #4 on: September 22, 2009, 02:24:33 AM »

Quote from: V@no link=topic=25893.  msg141173#msg141173 date=1253578819   [Expand]
interesting, the corrupted files are missing 25 bytes at the end.  .  . 
is gzip compression turned on  on your server (see zlib.  output_compression in phpinfo in ACP) or in 4images itself (see "Use GZip compression" in settings)?

I just double checked download.  php and couldn't find anything that could possible cause this.   it uses PHP's built in functions filesize() to detect filesize and readfile() to read and output file's content.  .  .  At this point all I could suspect is it's server related issue.  .  . 

I will check.   Should gzip be turned on or off?

If it was a server issue why would it allow them to be downloaded directly? I was thinking perhaps a php issue but what I don't know :)

-------------------

phpinfo says:
zlib. output_compression   On   On

gzip is set to "no" in 4images settings.

Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #5 on: September 22, 2009, 02:48:14 AM »

Ok, I just reproduced this on my local server. It's indeed conflicts with zlib.output_compression

The work around is to add this line in download.php, below <?php
1
@ini_set('zlib.output_compression''Off');
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
siredgar
Pre-Newbie

Offline Offline

Posts: 7

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #6 on: September 22, 2009, 04:11:35 AM »

Quote from: V@no link=topic=25893. msg141175#msg141175 date=1253580494   [Expand]
Ok, I just reproduced this on my local server.  It's indeed conflicts with zlib. output_compression

The work around is to add this line in download. php, below <?php
1
&#64;ini_set('zlib. output_compression', 'Off');

Excellent, thank you! This has resolved the problem!  Very much appreciated!

I'm curious as to the technical details.  zlib compression is on in my default php installation on the server, but this turns it off for just this script instance, right? Are there any drawbacks to not having zlib compression turned on?

Thanks again!

--- John
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #7 on: September 22, 2009, 05:05:35 AM »

Yes, you are correct. The problem with zlib compression, is that php/webserver itself will compress the output, which means, from within the script there is no way of knowing what final size will be of the outputed data.
The only other possible solution for this would be removing Content-Length header, which would be a minor problem for the client, as it wont be able see how much time/data left for the file to download.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
siredgar
Pre-Newbie

Offline Offline

Posts: 7

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #8 on: September 23, 2009, 04:44:45 PM »

Quote from: V@no link=topic=25893. msg141179#msg141179 date=1253588735   [Expand]
Yes, you are correct.  The problem with zlib compression, is that php/webserver itself will compress the output, which means, from within the script there is no way of knowing what final size will be of the outputed data.
The only other possible solution for this would be removing Content-Length header, which would be a minor problem for the client, as it wont be able see how much time/data left for the file to download.

Ah, ok! Thanks again :)
Logged
wooody
Pre-Newbie

Offline Offline

Posts: 9

Thank You
-Given: 0
-Receive: 2


View Profile
« Reply #9 on: October 30, 2011, 10:18:01 AM »

Hi,
i add @ini_set('zlib.output_compression', 'Off'); in Download.php  , but i'm still have problem..
also i remove  
header("Content-Length: ".$filesize."\n\n");

and it's not work , i have 4image 1.7.10

any help
-------------------------------------------------------------------------

That's my problem , I can't wait and still keep trying until i fix it..  Here is how with new version for 4images 1.7.10

go to include/zip.php and search for this code , located on line 200
1
    @ini_set('zlib.output_compression''0');
and change it to:
1
    @ini_set('zlib.output_compression''1');

save it, and that's will fix the problem.

Follow members gave a thank to your post:
mac420

For this post, 1 member gave a thank you!
« Last Edit: October 30, 2011, 11:32:25 AM by wooody » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.101 seconds with 22 queries.
Post your comments here