content-disposition

Force file download from HTTP on iOS

别来无恙 提交于 2019-12-25 11:53:44
问题 I am using a link to auto download file once clicked. This download is working all fine in Android and Windows. But on MAC and iOS the file is opening in browser only. It is not downloading. I'm setting below response headers: Content-Type: application/octet-stream Content-Disposition: attachment; filename="filename.csv" I checked on SO and some suggested to use Content-Type: application/force-download But it is Hack, not a standard as per comments. So how can I achieve download in iOS and

Java/Javascript read content-disposition file content

邮差的信 提交于 2019-12-25 05:17:14
问题 For my web site, I need to get some data from an URL whose response headers contains Content-Disposition attribute which forces me to download the file. I would like to know how I can read the content of the file without downloading the file to disk and do I/O to read it. Doing so in either Java or JavaScript would be fine. 回答1: Content-Disposition is just advisory. If you use a non-browser client (Java, curl, wget...) and do a GET request, you can just do whatever you want. (I guess this

wget breaking with content-disposition

你。 提交于 2019-12-22 11:15:21
问题 I am trying to download the kml file that is sent via Content-Disposition:attachment from the following website: http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia Using wget and curl with the command: wget --content-disposition http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia and curl -O -J -L http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia However, instead of saving the file being transmitter, it saves only the html content and at the end of

AWS S3: Force File Download using 'response-content-disposition'

空扰寡人 提交于 2019-12-22 10:43:59
问题 Few lines(below) generate signed URL to which browser is redirected to download a file from S3. I am facing well known issue of Chrome not downloading pdf files from S3 when content type is set as Octet Stream. The solution is to force chrome to download file instead of trying to read/open it. I tried adding 'response-content-disposition' to sign as well as URL, but it didn't work. How to use 'response-content-disposition' header when url is to be generated? String codedFilename= EncodingUtil

Download excel file in javascript from Rest API response content-disposition outputs [Object, Object]

只愿长相守 提交于 2019-12-22 08:33:49
问题 I want to download a excel file from my angularJs code. Where i made a http post request to Java Rest API and returned the file with header "Content-Disposition" : "attachment; filename=\"new_excel_file.xlsx\"" Java Code @Post @Path("/excel/trekResult") @Produces("application/vnd.ms-excel") public Response getResultsReport(@HeaderParam(Constants.ID) Long userId, @QueryParam(Constants.COMPANY_TREK_ID) Integer companyTrekId) { String CONTENT_DESPOSITION = "Content-Disposition"; String CONTENT

Get filename without Content-Disposition

六眼飞鱼酱① 提交于 2019-12-21 13:07:57
问题 I am looking for a solution for this problem for days and I can't find any. I want to download a file from a webserver with a webclient. The download works fine, but I can't get the real filename, which is very important for me. I read on many homepages, that the filename should be saved in the Content-Disposition-Header. Unfortunately this header of the site is empty. I tried to get it with: string header_contentDisposition =""; using (WebClient client = new WebClient()) { client.OpenRead

Linked image is not displayed in Internet explorer

雨燕双飞 提交于 2019-12-20 06:22:25
问题 I am facing a problem where linking of an image is working in all the browsers except internet explorer. I am suspecting a problem with the content disposition header value sent by the server. The server sends content disposition as attachment which instructs the browser to download the file . Now if i try to link the url with img tag , it gets rendered in all the browsers except IE. Sample is stored here https://www.w3schools.com/code/tryit.asp?filename=G180IFYZL1IS Best Regards, Saurav 来源:

Edge browser appears to discard response payload

僤鯓⒐⒋嵵緔 提交于 2019-12-20 04:22:08
问题 I have a web app that returns a PDF to the browser, which works fine in Chrome and Firefox, however it does not work in Edge (version 38.14393.0.0). The response header looks like this: Access-Control-Allow-Headers: Content-Type, Authorization Access-Control-Allow-Origin: * Cache-Control: no-store, no-cache, must-revalidate Content-Disposition: inline; filename="Invoice.PDF" Content-Length: 9255 Content-Type: application/pdf Date: Mon, 30 Jan 2017 04:38:25 GMT Pragma: no-cache Server:

Python Flask downloading a file returns 0 bytes

余生长醉 提交于 2019-12-19 06:57:56
问题 Here is the code my flask server is running: from flask import Flask, make_response import os app = Flask(__name__) @app.route("/") def index(): return str(os.listdir(".")) @app.route("/<file_name>") def getFile(file_name): response = make_response() response.headers["Content-Disposition"] = ""\ "attachment; filename=%s" % file_name return response if __name__ == "__main__": app.debug = True app.run("0.0.0.0", port = 6969) If the user goes to the site, it prints the files in the directory.

Special Characters in Content-Disposition filename

本小妞迷上赌 提交于 2019-12-17 21:58:37
问题 This thread is a duplicate of How to encode the filename parameter of Content-Disposition header in HTTP? But since this question was asked a long time ago and there is still no satisfying answer (in my opinion), I would like to ask again. I develop a C++ CGI application that delivers files that can contain special characters in their names like " weird # € = { } ; filename.txt " There seems to be no possibility to set the HTTP Content-Dispostion in a way that it works for every browser like