# Problem with upload image

**URL:** <https://discourse.getcockpit.com/t/problem-with-upload-image/2355>\
**Category:** Uncategorized\
**Created:** [May 9, 2022, 5:02pm UTC](https://discourse.getcockpit.com/t/problem-with-upload-image/2355 "2022-05-09T17:02:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ribaunz](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@ribaunz](https://discourse.getcockpit.com/u/ribaunz)\
**Post date:** [May 9, 2022, 5:02pm UTC](https://discourse.getcockpit.com/t/problem-with-upload-image/2355/1 "2022-05-09T17:02:04Z")

</div>

Hi, i try to install Cockpit on Windows Wamp and i’ve a problem with image upload.  
The problem is in the url:  
[http://localhost:8080/cp/cockpit/utils/thumb\_url?src=http://localhost:8080/C:/wamp64/www\logo\_gaia\_email.png&w=undefined&h=160&m=bestFit&re=1](http://localhost:8080/cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/www%5Clogo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1)  
The correct url for generate the thumb does not include localhost.  
Where is the setting for remove localhost:8080/ ?  
Thank’s a lot

---

<div class="post-metadata">

**Author:** ![Jamo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/jamo/32/1117_2.png) [@Jamo](https://discourse.getcockpit.com/u/Jamo)\
**Post date:** [May 12, 2022, 12:15pm UTC](https://discourse.getcockpit.com/t/problem-with-upload-image/2355/2 "2022-05-12T12:15:43Z")

</div>

I’m afraid you can’t set this directly in Cockpit. However, you can achieve this really easyly with JS.

```nohighlight
function removeHost(url) {
  let urlObj = new URL(url);
  return urlObj.pathname;
}

let address = removeHost('http://localhost:8080/cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/www\logo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1');

```

`address` will than be `/cp/cockpit/utils/thumb_url`

If you need to keep the URL parameters in your url, use this function instead:

```nohighlight
function removeHost(url) {
  let urlObj = new URL(url);
  let res = urlObj.href.replace(urlObj.origin, '');
  return res;
}

let address = removeHost('http://localhost:8080/cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/www\logo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1');

```

In that case, `address` will be `/cp/cockpit/utils/thumb_url?src=http://localhost:8080/C:/wamp64/wwwlogo_gaia_email.png&w=undefined&h=160&m=bestFit&re=1`

Cheers.
