Jump to content


This topic is now archived and is closed to further replies.


Download as application/octet-stream

Recommended Posts

I'm new here, so please excuse me if I happen to do something wrong at first, I'll learn.

I run a file host and am re-writing the scripts to maintain ease of use for myself and the users. Now I am using header() to display the files, and I have noticed that without applying header('Content-type:whatever') that in some browsers, the file is not recognized as the right format.

But if I apply:

[code]header('Content-type: application/octet-stream');
header('Content-Disposition: inline; filename=realFile.exe');

it works correctly. [b]But my question is:[/b] can I just use application/octet-stream for all file types (exe, jpg, bmp, zip, anything) and have it work correctly with all of them?

I tried:

[code]header('Content-type: application/octet-stream');
header('Content-Disposition: inline; filename=realFilename.jpg');

and it worked correctly, displaying the image and all. In IE, firefox, and Opera.

So I am wondering whether I need to make it so it does define the correct mime-type for all the file types or if I can just use the application/octet-stream for all of them?

Oh yes, and with Content-Disposition, can anyone clearly explain the difference between using 'inline' and 'attachment' to me? I have noticed that using 'attachment' usually steers more towards having to download the file, but can I just use 'inline' for all files because it seems to work correctly (tested in IE, Firefox, Opera)?

Please excuse the long first post, but it's late and I'm just trying to get a few problems out of the way.

Thank you in advance.

Edit: I just realized I stated that I tried using the method and it worked, and yet I still come here and ask questions about it. But I'm wondering if you think it will work with stability or if it just doesn't seem like a good idea in general?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.