Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download a File with extension TXT

Status
Not open for further replies.

mbinfo

Programmer
Aug 21, 2002
27
BR
I'm trying to download a file named N5AETC.TXT.
What must be the specified at the Content-Type field of the header?
I tried several options.
When using 'text/plain' the result changes to a display, not a file. If it is 'application/text' it appends a .php at the end of the file name - already set as "N5AETC.TXT".

Just for test I changed to 'application/msword' and the extension appended was '.doc'. If I have an option to have '.txt' appended I can simply use "N5AETC" and let it make what it wants. But I don't want my file named .php...

What is the work around?

Thanks
 
Thank you sleipnir214, but the (loooong) discussion only told me some things I already knew.
There is one item - about file names appended to URL's - that is significant for me. Although I'm NOT sending the file name with a URL, my browser IS Netscape 7.
With IE the file name problem did not showed up. That means: IE worked fine with the specifications I had.

I think the problem is the same, probably the root of it is the same bug. But I could not apply the work around suggested. I tried to put a slash prefixing my file name. Nothing worked.

I'll have to test it with other browsers and see what happens.
Thank you anyway.
 
Sleipnir214,

Yes and yes.
Here is my complete set of headers:

Code:
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate,
          post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/octetstream;
          name=\"{$filename}\";");
header("Content-Disposition: attachment;
          filename=\"{$filename}\";");
header("Content=Length: ".strlen($filecstr));

I realize the problem is up to Netscape, once IE is working fine. Among my customers I doubt if there is at least one using Ns7... So this problem is not a problem.
I must switch to other browser and see the results. I had no time to do this yet.

Thank you very much... If I can help you somehow, feel free to ask (ulisses at mb-info dot com dot br). You have a bonus credit in my "to do" tasks...

Ulisses
 
It's not:

application/octetstream

but rather:

application/octet-stream


I don't know if it will make a difference or not, but the dash is part of the string.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top