content-disposition

Content-Disposition:attachment not triggering download dialog

烈酒焚心 提交于 2019-11-30 11:32:36
I've encountered some unexpected behavior when trying to create a file download functionality on my NodeJS server. I have a REST (express) API that calls for some export data function, which creates a CSV file on the server and uses res.download('path/to/file') to trigger the download. Response headers include Content-Disposition:attachment; filename="indicators.csv" Content-Length:30125 Content-Type:text/csv; charset=UTF-8 so everything seems to be in order. The thing is, I get the response from the server as plain text. The response has all the data the CSV file contains, but does not

How to avoid duplicate content-disposition headers with MVC3 FileContentResult?

独自空忆成欢 提交于 2019-11-30 07:28:18
问题 We have some files stored in sql database. On an ASP.NET MVC3 form, we display 2 links: View this file | Download this file These links go to these corresponding action methods. The download works as expected -- clicking a link forces a save dialog in the browser. However, the display is causing duplicate Content-Disposition headers to be sent to the browser, resulting in an error on Chrome, and an empty page in Firefox. [ActionName("display-file")] public virtual ActionResult DisplayFile

Get Content-Disposition parameters

柔情痞子 提交于 2019-11-30 06:49:04
How do I get Content-Disposition parameters I returned from WebAPI controller using WebClient? WebApi Controller [Route("api/mycontroller/GetFile/{fileId}")] public HttpResponseMessage GetFile(int fileId) { try { var file = GetSomeFile(fileId) HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StreamContent(new MemoryStream(file)); response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment"); response.Content.Headers.ContentDisposition.FileName = file.FileOriginalName; /********* Parameter *

Get excel file (.xlsx) from server response in ajax

此生再无相见时 提交于 2019-11-30 05:28:32
问题 I have got a problem with getting excel file and opening download window in the browser after getting a response (in success ajax method) with that file. I have got appropriate Content-Type and Content-Disposition headers , I tried using Blob in js and I couldn't achieve what I want - simple file downloading. I accomplished few versions of my ajax, one of them is below. I developed ajax which returns excel file which I couldn't open properly because it's corrupted (despite .xlsx extension).

Cordova File Transfer remove Multipart or Content-Disposition Header

家住魔仙堡 提交于 2019-11-29 17:29:30
I managed to upload an image to my server using Cordova File Transfer plugin. var img = <full path to image> var url = <url to webservice> var options = new FileUploadOptions(); //no specified options, using defaults var ft = new FileTransfer(); ft.upload(img, encodeURI(url), win, fail, options); var win = function (r) { console.log('Successfully sent'); } var fail = function (error) { console.log("An error has occurred: Code = " + error.code); }; However, my server had problems reading the image due to the extra header added by the plugin. --+++++..Content-Disposition: form-data; name="file";

Content-Disposition:attachment not triggering download dialog

扶醉桌前 提交于 2019-11-29 17:16:24
问题 I've encountered some unexpected behavior when trying to create a file download functionality on my NodeJS server. I have a REST (express) API that calls for some export data function, which creates a CSV file on the server and uses res.download('path/to/file') to trigger the download. Response headers include Content-Disposition:attachment; filename="indicators.csv" Content-Length:30125 Content-Type:text/csv; charset=UTF-8 so everything seems to be in order. The thing is, I get the response

How to set content disposition on individual azure blob requests?

丶灬走出姿态 提交于 2019-11-29 12:44:57
I have an application that hosts videos, and we recently migrated to Azure. On our old application we gave the ability for users to either play or download the video. However on Azure it seems like I have to pick between which functionality I want, as the content disposition has to be set on the file and not on the request. So far I have came up with two very poor solutions. The first solution is streaming the download through my MVC server. CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]); CloudBlobClient blobClient =

Get Content-Disposition parameters

一世执手 提交于 2019-11-29 08:09:53
问题 How do I get Content-Disposition parameters I returned from WebAPI controller using WebClient? WebApi Controller [Route("api/mycontroller/GetFile/{fileId}")] public HttpResponseMessage GetFile(int fileId) { try { var file = GetSomeFile(fileId) HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StreamContent(new MemoryStream(file)); response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment"

How to avoid duplicate content-disposition headers with MVC3 FileContentResult?

三世轮回 提交于 2019-11-29 03:49:08
We have some files stored in sql database. On an ASP.NET MVC3 form, we display 2 links: View this file | Download this file These links go to these corresponding action methods. The download works as expected -- clicking a link forces a save dialog in the browser. However, the display is causing duplicate Content-Disposition headers to be sent to the browser, resulting in an error on Chrome, and an empty page in Firefox. [ActionName("display-file")] public virtual ActionResult DisplayFile (Guid fileId, string fileName) { var file = _repos.GetFileInfo(fileId); if (file != null) { Response

Content-Disposition with 302 redirect

半腔热情 提交于 2019-11-28 13:51:50
This was working last night, but I must have accidentally changed something, because it isn't now. What I am trying to do should be clear from these headers: Content-Disposition: attachment;filename=english_customizable.xml Location: http://tortoisewrath.com/files/2.xml However, when this header is sent, the Content-Disposition part doesn't work after the redirect. ...Why? sg3s What you're trying to do is inadvisable check this question; Header Location + Content Disposition Content-Disposition + Location header But you can do it, to make it work you will have to buffer your whole response