content-disposition

Cordova File Transfer remove Multipart or Content-Disposition Header

蹲街弑〆低调 提交于 2019-11-28 10:49:16
问题 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

Is Content-Disposition attachment blocked from XMLHttpRequest?

有些话、适合烂在心里 提交于 2019-11-28 10:20:27
I want to perform a javascript xhr request for a png file from a C# webserver which I wrote. Here is the code I use var imgUrl = "http://localhost:8085/AnImage.png?" + now; var request = new XMLHttpRequest(); request.open('GET', imgUrl, false); request.send(); // this is in a try/catch On the server-side I send back the file and add a Content-Disposition header. I obtain the following response I made sure that Content-Disposition was attached in the headers after the Content-Type (the screenshot is from Firebug, which appends in alphabetical order). The results is that no dialog box is

PHP: RFC-2231 How to encode UTF-8 String as Content-Disposition filename

末鹿安然 提交于 2019-11-28 08:29:51
问题 Scenario: (in PHP) I have a form submission with a UTF-8 encoded string ( $name ) to support international characters. Upon submitting the form (via GET), I am creating a CSV download file. I want the name of the file to be that string + .csv ( "$name.csv" ). For a western character set I can do this just fine by doing: header("Content-Disposition: attachment; filename=\"$name\""); But for other character sets, the download file's name is garbage letters + .csv (such as ×œ×œ× ×›×•×ª×¨×ª.csv )

PDF Handler : content-disposition filename

你。 提交于 2019-11-28 07:34:01
I am outputting a PDF file in a Web browser (IE8) HttpContext.Response.writefile(fileName) and it works great. When I try to save the file, it will give me the name of the ashx handler as a default. I would like to actually pass the real name. I tried to add header information as follow: context.Response.AddHeader("content-disposition", "attachment; filename=" + fileInfo.Name); And it works but I do not want the user to have to choose between open and save, i want the file to open normally and if the user chooses to save it then the dialog would give him/her the default filename. I tried also:

How to set content disposition on individual azure blob requests?

一笑奈何 提交于 2019-11-28 06:05:22
问题 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 =

Header Location + Content Disposition

邮差的信 提交于 2019-11-28 02:01:58
So I have a downloads page where you click a link, it opens /downloads/download/randomhash randomhash is found in the db, i increment a download counter, and then redirect to the actual file e.g. /uploads/2012/file.png. Everything works except for the redirect doing what I'd like it to do. I'm not sure why it's not working... header("Location: " . $row->uri); header("Content-Disposition: attachment; filename=$row->name"); On the first load of the file, it has the appropriate content-disposition header (in firebug), but it doesn't prompt the file to be downloaded (which it should, right??). Any

forcing a file download with php

半世苍凉 提交于 2019-11-28 01:45:50
I know how to make the download occur, when the download happens it appends the html from the web page that causes the download. How do I filter out the HTML? I understand that you're trying to output some stream for download from PHP page? If so, then don't output that content from the page that contains HTML, but redirect to separate php page that outputs only the download stream, with headers if necessary. If I understand you correctly it's a common problem. I solved it by using ob_start at the beginning of my index.php (start/root/entry file) before ANY output occures and for the download

How to set response filename without forcing “save as” dialog

元气小坏坏 提交于 2019-11-27 17:21:56
I am returning a stream in some response setting the appropriate content-type header. The behavior I'm looking for is this: If the browser is able to render content of the given content type then it should display it in the browser window. If the browser doesn't know how to render the content, then it should display the "save as" dialog where the filename should be the one provided in the response. The problem is that if I set the Content-Disposition header with: "attachment; filename="myfile.txt"" the browser will always display the "save as" dialog. If I don't set Content-Disposition , the

Unicode in Content-Disposition header

孤街浪徒 提交于 2019-11-27 15:06:32
I am using HttpContext object implemented in HttpHandler child to download a file, when I have non-ascii characters in file name it looks weird in IE whereas it looks fine in Firefox. below is the code:- context.Response.ContentType = ".cs"; context.Response.AppendHeader("Content-Length", data.Length.ToString()); context.Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}",filename)); context.Response.OutputStream.Write(data, 0, data.Length); context.Response.Flush(); when I supply 'ß' 'ä' 'ö' 'ü' 'ó' 'ß' 'ä' 'ö' 'ü' 'ó' in file name field it looks

Force download of 'data:text/plain' URL

此生再无相见时 提交于 2019-11-27 15:06:16
I was wondering whether it is possible to force a browser (at least Chrome) to download a data:text/plain URL. Chrome does download binary URLs (e.g. data:application/zip;base64,... ), but it does not download files that can be viewed inside the browser (such as text files). What I already tried with no luck so far is this: data:text/plain;content-disposition=attachment;filename=test.txt;... But it seems like I cannot add headers like this. Is there any way to make Chrome download a data:text/plain,... URL? As of now, it has been made possible to use <a download> in Chrome. Using dispatchEvent