FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


File unable to be downloaded





Animal
On my downloads page, I've got a couple of zip files and a tar.gz file, along with some GPG File Signature files.

All the files are able to be downloaded except mobility-mail-linux.tar.gz.asc - the tar.gz file signature. I've checked, double-checked, re-uploaded and downloaded the file from ftp and it's ok, it still verifies the file. For some reason, you can't download it at all from the web. The other signature files, such as mobility-mail-win.zip.asc still work... weird. I've tried in Firefox and IE, and yes, I've cleared cache files etc.

Any ideas why this won't work? Is it to do with the triple-file-extension?
Bondings
This has to do with the file extensions for sure.

Let me explain. You provide a link to a file on your website. The browser then decides what to do with it. If in the settings for those type of files, it isn't set to be downloaded, then it won't download them, unfortunately.

Now, what can we do about it? I have heard from a lot of people that the only thing you can do is ask your visitors to change their browser settings. That's a funny suggestion. Most people won't even know how to do it.

Anyway, you can let the browser know it should download the files with http headers.

I'm currently searching for the exact code, I'm not that good in headers.
Animal
Bondings wrote:
You provide a link to a file on your website. The browser then decides what to do with it. If in the settings for those type of files, it isn't set to be downloaded, then it won't download them, unfortunately.


Right... even if you right-click and save-as?

The other "ultimate" file extensions are .asc too. Strange and confusing, I'm sure you'll agree! Thanks for the help tho!
mathiaus
Following from what Bondings said .... http://uk2.php.net/header

Quote:
If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.

Code:
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('original.pdf');
?>


I would've thought that could just be changed to mobility-mail-linux.tar.gz.asc
Bondings
Ok, I just found the exact code. Just put this in a php file in the same directory and link to that file for the download.

Code:
<?php
// We'll be outputting the file for download
header('Content-type: application/force-download');

// It will be called mobility-mail-linux.tar.gz.asc
header('Content-Disposition: attachment; filename="mobility-mail-linux.tar.gz.asc "');

// The source is in mobility-mail-linux.tar.gz.asc
readfile('mobility-mail-linux.tar.gz.asc ');
?>
Bondings
Lol, mathiaus, I was a bit too slow. I didn't see your post.
Animal
Ah, many thanks guys - got it working perfectly now!

The help was most appreciated. This thread is resolved and can now be closed... wait a minute... I can close it myself!

Laughing


-close-
Related topics
php forum help
BIOS
Content not updating
Why did I get 13.1 kb/s download speed on dialup?
problem with my computer
Rapidsharinig
A question about PNG and IE
Run Linux from CD
Garfield
Bandwidth Question
[RESOLVED] php file upload problem
Upload file porblem {fixed}
problem with file permissions
how to unlock a zip or rar file
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.