This error seems to come up more then expected. I will try and explain a fix workaround.
These are the basic content type header setting for downloading files.
application/x-octet-stream
application/force-download
application/octet-stream
application/download
With fetch we create a content type header that matches the file type ie.
test_zip_file.zip would match -> $content_type="application/zip"
OK you are getting a bad zip file when downloaded.
To fix this you can change the content type that is assigned to the file extension ie.
Code:
case "zip": $content_type="application/zip"; break;
to
Code:
case "zip": $content_type="application/x-octet-stream"; break;
Now download the zip file again and see if that content type change fixed the issue. If not change the content type till it works.
Here is the fetch file that needs to be edited /includes/classes/fetch_download.php at line 52 you will find this switch statement.
Code:
switch( $file_extension ) { // the file type
// Application files
case "pdf": $content_type="application/pdf"; break;
case "exe": $content_type="application/octet-stream"; break;
case "zip": $content_type="application/zip"; break;
case "doc": $content_type="application/msword"; break;
case "xls": $content_type="application/vnd.ms-excel"; break;
case "ppt": $content_type="application/vnd.ms-powerpoint"; break;
// Image files
case "gif": $content_type="image/gif"; break;
case "png": $content_type="image/png"; break;
case "jpeg":
case "jpg": $content_type="image/jpg"; break;
// Audio files
case "mp3": $content_type="audio/mpeg"; break;
case "wma": $content_type="audio/x-ms-wma";break;
case "wav": $content_type="audio/x-wav"; break;
// Video files
case "mpeg":
case "mpe":
case "mpg": $content_type="video/mpeg"; break;
case "avi": $content_type="video/x-msvideo"; break;
case "wmv": $content_type="video/x-ms-wmv";break;
case "mov": $content_type="video/quicktime"; break;
//The following are for extensions that shouldn't be downloaded (sensitive stuff, like php files)
case "php":
case "htm":
case "html":
case "cgi": die("<h1>ERROR: Disallowed use for ". $file_extension ." files!</h1>"); break;
default: $content_type="application/force-download";
}
Hope that helped.
Skip
Bookmarks