# Download pictures from URL and save to file

**URL:** https://discourse.nodered.org/t/download-pictures-from-url-and-save-to-file/69391
**Category:** General
**Created:** [21 October 2022 16:35 UTC](https://discourse.nodered.org/t/download-pictures-from-url-and-save-to-file/69391 "2022-10-21T16:35:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![andre\_x](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@andre\_x](https://discourse.nodered.org/u/andre_x)
#### Post date: [21 October 2022 16:35 UTC](https://discourse.nodered.org/t/download-pictures-from-url-and-save-to-file/69391/1 "2022-10-21T16:35:46Z")

</div>

Hi all!  
I'm trying to download a picture from [unsplash.com](http://unsplash.com) and save it to a file, but...I can't!  
The file gets downloaded, but it's not an image (Windows says that it's an unsupported format).  
I've tried to save the file in base64, but it doesn't change anything.  
The flow is pretty simple:

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f1de05a533eea702abfa9dff27147dec03c0c573.png)

What's wrong with it?

```auto
[{"id":"013c7a22beb6ab0f","type":"inject","z":"43c90ca80bbceedd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":280,"y":160,"wires":[["774b29243863822b"]]},{"id":"774b29243863822b","type":"http request","z":"43c90ca80bbceedd","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://source.unsplash.com/3840x2160/?space,astronomy,pleasant,places,landscape","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"credentials":{},"x":490,"y":160,"wires":[["2807546d40cd9116","f22198f9c8fac199"]]},{"id":"f22198f9c8fac199","type":"file","z":"43c90ca80bbceedd","name":"","filename":"C:\\wallpaper\\image2.jpg","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":750,"y":160,"wires":[[]]},{"id":"2807546d40cd9116","type":"debug","z":"43c90ca80bbceedd","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":100,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [21 October 2022 16:38 UTC](https://discourse.nodered.org/t/download-pictures-from-url-and-save-to-file/69391/2 "2022-10-21T16:38:12Z")

</div>

Set the http request node to return a binary buffer (not a string)

---

<div class="post-metadata">

### Author: ![andre\_x](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@andre\_x](https://discourse.nodered.org/u/andre_x)
#### Post date: [21 October 2022 16:39 UTC](https://discourse.nodered.org/t/download-pictures-from-url-and-save-to-file/69391/3 "2022-10-21T16:39:41Z")

</div>

Aaaaah, so simple!!!  
Thanks a lot!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [4 November 2022 16:39 UTC](https://discourse.nodered.org/t/download-pictures-from-url-and-save-to-file/69391/4 "2022-11-04T16:39:50Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
