Jump to content


Photo

Download as application/octet-stream


  • Please log in to reply
No replies to this topic

#1 rathfon

rathfon
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 31 May 2006 - 07:36 AM

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:

header('Content-type: application/octet-stream');
header('Content-Disposition: inline; filename=realFile.exe');
readfile($theFileURL);

it works correctly. But my question is: 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:

header('Content-type: application/octet-stream');
header('Content-Disposition: inline; filename=realFilename.jpg');
readfile($thefileURL);

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users