Hi everyone,

I am trying to download an image via Dropbox URL with the following code:

----> %HTTPoison.Response{body: body} = HTTPoison.get!(“”)
----> File.write!(“image.jpg”, body)

The file is created successfully with File.write!/2. But when I try to open it, it says the file is corrupted and the size of the file is also different from the original size.

Can anyone guide me on this issue?

Thanks for the help.

Sasank Yadavalli

1 Like

is the image public?

try with a known public image and see if it works

1 Like

Thank you for replying,

The URL you have given works perfectly fine and I could able to open the image.

The image I am trying to download is public. I tried to cURL the URL and the response is the following:

{".tag": “file”, “url”: “”, “id”: “id:mWeUIZAKlvAAAAAAAAAAAQ”, “name”: “WeVnWhite-1.JPG”, > “link_permissions”: {“resolved_visibility”: {".tag": “public”}, “can_revoke”: false, “revoke_failure_reason”: {".tag": “owner_only”}}, “client_modified”: “2016-05-26T08:54:02Z”, “server_modified”: “2016-06-01T09:56:05Z”, “rev”: “6d9111555db5”, “size”: 1348544}%

1 Like

Well, that URL does not oint to the actual image URL, it only points to a webpage from which you can then choose multiple interactions with dropbox.


I don’t know dropbox specifics, but seems like you either have to scrape the html page or see if their api can help you out - try with but ymmv