I'm working on a PHP based site with download-able files, which come zipped on download. IE, Chrome and Safari have no issue with recognizing the file extension. Firefox, on the other hand, leaves off the file type. It's easy enough to just add .zip to the end of the file name, but is there a hack/fix/work-around that can be put in the code (or some other way) to force the extension to attached to the file?
I think you need to recompress it a few hundred times recursively in a ZipArchive() to get my script to work as intended. Firefox thinks its a zip and saves it as a .zip
I'm working on a PHP based site with download-able files, which come zipped on download. IE, Chrome and Safari have no issue with recognizing the file extension. Firefox, on the other hand, leaves off the file type. It's easy enough to just add .zip to the end of the file name, but is there a hack/fix/work-around that can be put in the code (or some other way) to force the extension to attached to the file?
I've downloaded plenty of zip files over the years with FF and never ran into this issue, so I'm not really sure what to suggest without knowing the specifics of what you're doing in your code. Eval's header() suggestions should deal with it OK, setting the attachment stuff and content-type.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I've downloaded plenty of zip files over the years with FF and never ran into this issue, so I'm not really sure what to suggest without knowing the specifics of what you're doing in your code. Eval's header() suggestions should deal with it OK, setting the attachment stuff and content-type.
I too have never had an issue with downloading files from Firefox, until this site. It was developed by an outside vendor before I came on board. My co-worker and I are trying to sort through the mess. (Believe me; it's fairly sloppy and somewhat confusing.)
Hmm...I wonder if it is setting a Content-Type header() indicating a Zip archive (probably "application/zip") and then sending a file name without a ".zip" suffix? It might be worth checking the HTTP response headers to see if it gives any clues along that line.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I had a similar problem today, only with a different file type. Adding quotes around the filename seems to have fixed it, but for some reason IE replaces spaces with underscores, though that's not a problem.
Hmm... Seems I can't edit my post =/
Anyways, I've just made a post on my site that goes into more detail and includes the problem snippet I had to fix - may be worth taking a look
Bookmarks