download

Anchor download attribute created with javascript not working on iOS Chrome

狂风中的少年 提交于 2020-12-13 19:00:33
问题 I have a video/mp4 file saved in AWS S3 bucket, which should be downloaded from a client device (phone or computer) when the user clicks on an icon. I first make a request using fetch , and then create a blob object from the response. Next, I create an anchor element using javascript, I attach the href attribute and trigger it's click as on the code below: fetch(url, { headers: new Headers({ 'Content-Disposition': "attachment; filename='file-name.mp4'", }), }).then((response): void => { if (

How do I create a Presigned URL to download a file from an S3 Bucket using Boto3?

大城市里の小女人 提交于 2020-12-11 08:49:12
问题 I have to download a file from my S3 bucket onto my server for some processing. The bucket does not support direct connections and has to use a Pre-Signed URL . The Boto3 Docs talk about using a presigned URL to upload but do not mention the same for download. 回答1: import boto3 s3_client = boto3.client('s3') BUCKET = 'my-bucket' OBJECT = 'foo.jpg' url = s3_client.generate_presigned_url( 'get_object', Params={'Bucket': BUCKET, 'Key': OBJECT}, ExpiresIn=300) print(url) For another example, see:

How do I create a Presigned URL to download a file from an S3 Bucket using Boto3?

廉价感情. 提交于 2020-12-11 08:47:07
问题 I have to download a file from my S3 bucket onto my server for some processing. The bucket does not support direct connections and has to use a Pre-Signed URL . The Boto3 Docs talk about using a presigned URL to upload but do not mention the same for download. 回答1: import boto3 s3_client = boto3.client('s3') BUCKET = 'my-bucket' OBJECT = 'foo.jpg' url = s3_client.generate_presigned_url( 'get_object', Params={'Bucket': BUCKET, 'Key': OBJECT}, ExpiresIn=300) print(url) For another example, see:

Button for downloading SVG in JavaScript & HTML?

做~自己de王妃 提交于 2020-12-10 11:57:34
问题 There's an SVG image that's rendered in the browser. I want a button below to download the SVG. Looks like download with proper mimetype is the way to go. Attempt: <div id="container"></div> <button id="download">Download SVG</button> function downloadSVG() { const svg = document.getElementById('container').innerHTML; /*console.info(btoa(svg)); document.getElementById('svg').src = `data:image/svg+xml;utf8,${document.createTextNode(svg).textContent}`; console.info('src:', document

HTML5 download attribute not working cross-domain? Can it be made to work? [duplicate]

牧云@^-^@ 提交于 2020-12-06 07:05:50
问题 This question already has an answer here : html download attribute redirects to url instead of downloading (1 answer) Closed 9 days ago . Consider the following page: https://8chan.co/stackoverflow.html Why does the first link work, but the second link doesn't? Do I need to send a certain header, or is it impossible to use the download attribute on a subdomain? 回答1: Chrome actually does allow the download attribute on cross-origin files, without CORS headers, but Firefox chose not to, citing

HTML5 download attribute not working cross-domain? Can it be made to work? [duplicate]

狂风中的少年 提交于 2020-12-06 07:04:22
问题 This question already has an answer here : html download attribute redirects to url instead of downloading (1 answer) Closed 9 days ago . Consider the following page: https://8chan.co/stackoverflow.html Why does the first link work, but the second link doesn't? Do I need to send a certain header, or is it impossible to use the download attribute on a subdomain? 回答1: Chrome actually does allow the download attribute on cross-origin files, without CORS headers, but Firefox chose not to, citing

Which HTTP method to use for file downloading?

给你一囗甜甜゛ 提交于 2020-12-05 02:33:31
问题 In my site users can download their files. But files are generated by using PHP. So what's HTTP method should I use for sending request for download as file attachment? GET or POST? 回答1: GET is for passively retrieving files, POST is for altering information on the server. This is as seen from the client, it doesn't matter what the server does or doesn't do in the process. So unless you're altering some server state in the request: GET. 回答2: GET From http://en.wikipedia.org/wiki/Hypertext

Which HTTP method to use for file downloading?

雨燕双飞 提交于 2020-12-05 02:33:08
问题 In my site users can download their files. But files are generated by using PHP. So what's HTTP method should I use for sending request for download as file attachment? GET or POST? 回答1: GET is for passively retrieving files, POST is for altering information on the server. This is as seen from the client, it doesn't matter what the server does or doesn't do in the process. So unless you're altering some server state in the request: GET. 回答2: GET From http://en.wikipedia.org/wiki/Hypertext

Interesting download error when trying to download html canvas as image with button

懵懂的女人 提交于 2020-11-30 00:12:46
问题 When I first click the button it doesn't work. On my second click it downloads 1 picture. My 3rd click it downloads 2 pictures. On my 4th click it downloads 3 pictures. So 1-0, 2-1, 3-2, 4-3. They are also downloaded immediately, it doesn't ask where to save. js: function xyz(){ const text =canvas.api.getCanvasAsImage(); const download = document.getElementById('download'); download.addEventListener('click', function(e) { var link = document.createElement('a'); link.download = 'download.png';

Interesting download error when trying to download html canvas as image with button

生来就可爱ヽ(ⅴ<●) 提交于 2020-11-30 00:11:55
问题 When I first click the button it doesn't work. On my second click it downloads 1 picture. My 3rd click it downloads 2 pictures. On my 4th click it downloads 3 pictures. So 1-0, 2-1, 3-2, 4-3. They are also downloaded immediately, it doesn't ask where to save. js: function xyz(){ const text =canvas.api.getCanvasAsImage(); const download = document.getElementById('download'); download.addEventListener('click', function(e) { var link = document.createElement('a'); link.download = 'download.png';