1

While it seems to be possible to drag a file from a browser to the desktop as per this post, it doesn't seem to work for files on Amazon S3 that require credentials that are passed as query string parameters. The url of the file I am trying to copy is in this format:

https://my-domain.amazonaws.com/uploads/mypath/myfile.txt?X-Amz-Expires=86400&X-Amz-Date=20180924T195935Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=mycredential&X-Amz-SignedHeaders=host&X-Amz-Signature=mysig

If I change the permissions on the file in S3 to be public and change the path to be:

https://my-domain.amazonaws.com/uploads/mypath/myfile.txt

all works correctly.

I am binding to the dragstart event and setting the download url as follows:

evt.originalEvent.dataTransfer.setData("DownloadURL", "https://my-domain.amazonaws.com/uploads/mypath/myfile.txt?X-Amz-Expires=86400&X-Amz-Date=20180924T195935Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=mycredential&X-Amz-SignedHeaders=host&X-Amz-Signature=mysig");

Is there any way make the file download with the credentials passed?

mahi-man
  • 4,326
  • 2
  • 25
  • 36

0 Answers0