Saving a file locally in Firefox, how to set the file type from .part to [.pdf | .doc | .txt ,etc ]
I have generated content in the browser and would like to save that content to a file on the user's system as a PDF, DOC, or TXT file. I would like to prompt the user with the "open" / "save as" dialog box, and have Firefox identify the proper application/file type.
My progress so far: I am able to prompt the user to save the file locally but I am unable to set the file name and application/file type in the dialog box. Firefox is setting the file extension to ".part", file name appears to be the first 20+ characters of file data, and the application/file type is set to data stream. How can I set the file name an开发者_StackOverflow中文版d application type in FF (and in IE as well.)
Thanks -ven
I'm not sure what language you are using, Im pretty sure its not C#.
Nevertheless, in C#, the open/save file dialoug has a Filter option which allows which file extensions can be used... Is this HTML your using?
Firefox will pick up the file name from the Content-Disposition:
header and the type from the Content-Type:
header.
精彩评论