content-disposition

HttpClient wrong encoding in Content-Disposition

一个人想着一个人 提交于 2020-12-31 14:18:58
问题 I am POST-ing an image with HttpClient and it works well for files with Latin names, but as soon as a name contains any non-ASCII characters it gets transformed to a sequence of question marks. If I create an html form and use a browser to post the file, the file name is sent in UTF8 and the target server perfectly accepts it. using (var client = new HttpClient()) { var streamContent = new StreamContent(someImageFileStream); streamContent.Headers.Add( "Content-Disposition", "form-data; name=\

HttpClient wrong encoding in Content-Disposition

放肆的年华 提交于 2020-12-31 14:17:09
问题 I am POST-ing an image with HttpClient and it works well for files with Latin names, but as soon as a name contains any non-ASCII characters it gets transformed to a sequence of question marks. If I create an html form and use a browser to post the file, the file name is sent in UTF8 and the target server perfectly accepts it. using (var client = new HttpClient()) { var streamContent = new StreamContent(someImageFileStream); streamContent.Headers.Add( "Content-Disposition", "form-data; name=\

docx file doesnt open in browser with content disposition inline in IE 8

人走茶凉 提交于 2020-02-24 14:58:10
问题 I want to open docx file in IE from asp.net. The IIS has mime type correctly mapped. I can open pdf fine but docx will always prompt me to download like content-disposition='attachment'. Is there any setting to be done? Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.Cookies.Clear(); Response.Cache.SetCacheability(HttpCacheability.Private); Response.CacheControl = "private"; Response.Charset = System.Text.UTF8Encoding.UTF8.WebName; Response.ContentEncoding =

docx file doesnt open in browser with content disposition inline in IE 8

扶醉桌前 提交于 2020-02-24 14:58:06
问题 I want to open docx file in IE from asp.net. The IIS has mime type correctly mapped. I can open pdf fine but docx will always prompt me to download like content-disposition='attachment'. Is there any setting to be done? Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.Cookies.Clear(); Response.Cache.SetCacheability(HttpCacheability.Private); Response.CacheControl = "private"; Response.Charset = System.Text.UTF8Encoding.UTF8.WebName; Response.ContentEncoding =

how to determine the filename of content downloaded with HTTP in Python?

安稳与你 提交于 2020-01-22 17:22:28
问题 I download a file using the get function of Python requests library. For storing the file, I'd like to determine the filename they way a web browser would for its 'save' or 'save as ...' dialog. Easy, right? I can just get it from the Content-Disposition HTTP header, accessible on the response object: import re d = r.headers['content-disposition'] fname = re.findall("filename=(.+)", d) But looking more closely at this topic, it isn't that easy: According to RFC 6266 section 4.3, and the

ASP.NET: Create CSV and save file on client machine

蓝咒 提交于 2020-01-06 05:49:04
问题 Requirement: I have an ASP.NET application where a page has data displayed in gridview. This form also has a textbox which takes filepath as input, with a save button beside it. Now when the user clicks on save the csv should save it on client machine at the path the user entered. I tried opening up a SaveAs Dialogbox using the "Content-Disposition attachment filename". But it always opens up on its default path. Is there a way to open up this SaveAs Dialog on user-specific path. Else is

duplicate headers received from server using Struts2 [duplicate]

痴心易碎 提交于 2020-01-06 02:30:25
问题 This question already has an answer here : How to define the stream Result annotation? (1 answer) Closed last year . I am using Struts2 in an application. I need to download excel file(.xlsx and .xls formats). This is working properly in IE but in Chrome it is showing error "Duplicate headers received from server" I use quotes before the file name("<File Name"). Still it is not working in chrome. Below is the code snippets used in my application. struts.xml <action name="*Excel" method="{1}"

Android browser/webview bug? Content-Disposition: attachment; filename=“xyz.txt”

99封情书 提交于 2020-01-01 18:51:09
问题 So an android browser or a webview works fine with urls like this - abc.com/xyz.txt However, if your URL looks like this - abc.com/xyz.php and what's sent to the browser in the headers is - Content-Disposition: attachment; filename="xyz.txt", then the Android browsers and web view seems to get terribly confused. It looks like it saves the correct file name on the phone, but the contents is filled with the webpage that was previously being viewed. This works perfectly well on PC based browsers

Prompt user to save on download from Dropbox

人走茶凉 提交于 2019-12-31 04:51:12
问题 I want to have a link to download a file from Dropbox that prompts the user instead of displaying the file in the browser. This probably requires setting a content-disposition header to 'attachment'. I'm currently using the dropbox media URL as described here: https://www.dropbox.com/developers/reference/api#media It seems my alternative might be to create a proxy, but I'd obviously like to avoid that. Is there a way to get this behavior from a direct Dropbox link? 回答1: Found the answer

How to get file name from content-disposition

蓝咒 提交于 2019-12-28 05:48:05
问题 I Downloaded file as response of ajax. How to get file name and file type from content-disposition and display thumbnail for it. i got many search results but couldn't find right way. $(".download_btn").click(function () { var uiid = $(this).data("id2"); $.ajax({ url: "http://localhost:8080/prj/" + data + "/" + uiid + "/getfile", type: "GET", error: function (jqXHR, textStatus, errorThrown) { console.log(textStatus, errorThrown); }, success: function (response, status, xhr) { var header = xhr