Reputation: 25994
I am trying to figure out if "Content-Disposition:attachment; filename=file_name" is required or not when file is sent as an attachment, and I am interested to persist it by the original name on a storage (drive). It looks like this is the only way to retrieve the original file name, but RFC is so muddy on it (link to RFC). It uses words such as "should" and not "must". WIKI (link to WIKI) says it better, but it's not RFC I can take to the client. Ideas?
Upvotes: 2
Views: 4548
Reputation: 117313
The header is optional, of course, but including it is a good idea if you do have a preference for
The browser or user-agent is not bound by this header, but treats it as a suggestion. The actual behaviour of the browser can be complex, but typically, in absense of this header a browser will decide on an appropriate course of action primarily based on its Mime type, and if it is an unrecognised Mime type it will usually default to saving as an attachment.
Using the Content-Disposition header gives you control in the following cases
Upvotes: 2