# Image Upload withREST API

**URL:** <https://forum.shopware.com/t/image-upload-withrest-api/70467>\
**Category:** Programming (EN)\
**Created:** [27. Oktober 2020 um 11:39 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467 "2020-10-27T11:39:29Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![BastianHbner](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BastianHbner](https://forum.shopware.com/u/BastianHbner)\
**Post date:** [27. Oktober 2020 um 11:39 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/1 "2020-10-27T11:39:29Z")

</div>

Hi, I’m trying to upload some images with the following command but i get an error message all the time. Does anyone have any idea why?

 ![https://i.imgur.com/n6t8Fky.png](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/c/ce2a73260ac147d37b5219f4f3bc4837138ec6a6.png)

---

<div class="post-metadata">

**Author:** ![oliverriske](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@oliverriske](https://forum.shopware.com/u/oliverriske)\
**Post date:** [27. Oktober 2020 um 11:43 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/2 "2020-10-27T11:43:22Z")

</div>

Url like http://… not c filesystem

Rest Api works over http&nbsp;

---

<div class="post-metadata">

**Author:** ![BastianHbner](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BastianHbner](https://forum.shopware.com/u/BastianHbner)\
**Post date:** [27. Oktober 2020 um 11:46 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/3 "2020-10-27T11:46:57Z")

</div>

Hi Oliver,

&nbsp;

but is there no way to upload an image stored on my computer?

---

<div class="post-metadata">

**Author:** ![oliverriske](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@oliverriske](https://forum.shopware.com/u/oliverriske)\
**Post date:** [27. Oktober 2020 um 11:50 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/4 "2020-10-27T11:50:58Z")

</div>

Not with rest api. Put the files via ftp on webserver to upload.

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [27. Oktober 2020 um 12:08 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/5 "2020-10-27T12:08:11Z")

</div>

There is a misunderstanding.

The information you are sending to your Api(Server) ist just an information (body)&nbsp;that will be read by the server and not by&nbsp;your home-Computer. So when the server reads that there is a link to C.&nbsp; it does not know what to do cause it won’t have access to your computer neither it will have a C:-Drive

---

<div class="post-metadata">

**Author:** ![BastianHbner](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BastianHbner](https://forum.shopware.com/u/BastianHbner)\
**Post date:** [27. Oktober 2020 um 12:14 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/6 "2020-10-27T12:14:19Z")

</div>

Thanks for the fast help but yes i think then i have a missunderstanding here. In The Admin Interface from the shop you can move to media and import media from my computer manually. So there must be a way to do that via http call without transfering them to a webserver first or am i wrong?

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [27. Oktober 2020 um 12:49 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/7 "2020-10-27T12:49:28Z")

</div>

When you are using a website interface it is uploaded to the server via a underlaying&nbsp;html-formular.&nbsp;

---

<div class="post-metadata">

**Author:** ![BastianHbner](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BastianHbner](https://forum.shopware.com/u/BastianHbner)\
**Post date:** [27. Oktober 2020 um 16:33 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/8 "2020-10-27T16:33:58Z")

</div>

Hi brettvormkopp,

&nbsp;

but there must be any way to upload an image which i have stored on my computer via API or not?

---

<div class="post-metadata">

**Author:** ![oliverriske](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@oliverriske](https://forum.shopware.com/u/oliverriske)\
**Post date:** [27. Oktober 2020 um 16:36 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/9 "2020-10-27T16:36:02Z")

</div>

Ftp!

---

<div class="post-metadata">

**Author:** ![BastianHbner](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BastianHbner](https://forum.shopware.com/u/BastianHbner)\
**Post date:** [27. Oktober 2020 um 16:39 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/10 "2020-10-27T16:39:31Z")

</div>

I understand that but we don’t have any ftp server to upload first and i can’t believe that there is no other way

---

<div class="post-metadata">

**Author:** ![oliverriske](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@oliverriske](https://forum.shopware.com/u/oliverriske)\
**Post date:** [27. Oktober 2020 um 16:44 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/11 "2020-10-27T16:44:04Z")

</div>

Manual upload in the Backend

---

<div class="post-metadata">

**Author:** ![BastianHbner](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@BastianHbner](https://forum.shopware.com/u/BastianHbner)\
**Post date:** [27. Oktober 2020 um 16:47 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/12 "2020-10-27T16:47:48Z")

</div>

How could that be that in SW 5 it was possible to upload an image directly from a computer and in SW 6 not?

---

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [28. Oktober 2020 um 11:40 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/13 "2020-10-28T11:40:42Z")

</div>

It is not possible via the Api. Wether SW5 nor SW6 can do it, nor any other Api on this world.

The concept is, that there is link to a public source for the hosting place of that image&nbsp;on any Server(public PC). Since your PC is not public you have to choose a server. Or you make your PC public with DDNS.

What is maybe possible is that you encode your Imagefile into a String, like base64. But iam unaware if this works with Shopware.

---

<div class="post-metadata">

**Author:** ![brender](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@brender](https://forum.shopware.com/u/brender)\
**Post date:** [17. März 2021 um 16:17 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/14 "2021-03-17T16:17:46Z")

</div>

In the post request you can send the image as binary data.

---

<div class="post-metadata">

**Author:** ![Muntz](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/muntz/32/13564_2.png) [@Muntz](https://forum.shopware.com/u/Muntz)\
**Post date:** [14. Oktober 2021 um 14:59 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/15 "2021-10-14T14:59:47Z")

</div>

just make the POST with content type image/png and body file\_get\_contents(c:/…)

---

<div class="post-metadata">

**Author:** ![fritzmg](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/fritzmg/32/20444_2.png) [@fritzmg](https://forum.shopware.com/u/fritzmg)\
**Post date:** [27. April 2023 um 09:54 UTC](https://forum.shopware.com/t/image-upload-withrest-api/70467/16 "2023-04-27T09:54:28Z")

</div>

According to [REST API - Examples using the media resource](https://developers.shopware.com/developers-guide/rest-api/examples/media/#configuration-2) it is possible via `base64` for example. Haven’t tried though.
