# Path to assets broken after uploading to webserver

**URL:** <https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787>\
**Category:** Questions\
**Tags:** v3\
**Created:** [October 26, 2021, 11:59am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787 "2021-10-26T11:59:48Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 26, 2021, 11:59am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/1 "2021-10-26T11:59:49Z")

</div>

Hi  
I’m still messing around with Kirby 🙂

Locally I run Kirbys server: php -S localhost:8000 kirby/router.php  
Everything is fine when testing it locally.

But after uploading all files to the hosting-webserver, the path to the assets is broken.  
Kirby does not recreate the asset-files in /media.

Example:  
Project-Logo-File, locally:  
[http://localhost:8000/media/site/c60d70679b-1624237861/projekt-logo-start.svg](http://localhost:8000/media/site/c60d70679b-1624237861/projekt-logo-start.svg)

Same file after uploading all files to a blank hosting-webserver-directory:  
[https://test.mydomain.ch/media/site/f72ef4e0c1-1635248335/projekt-logo-start.svg](https://test.mydomain.ch/media/site/f72ef4e0c1-1635248335/projekt-logo-start.svg)  
(/media/site/f72ef4e0c1-1635248335/projekt-logo-start.svg does not exist on the server)

Edit:  
When I delete /media on the webserver, then only “pages” get recreate, but not images and so on.

Any idea what I do wrong?

Kind regards  
Alain

---

<div class="post-metadata">

**Author:** ![moonwalk](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@moonwalk](https://forum.getkirby.com/u/moonwalk)\
**Post date:** [October 26, 2021, 12:38pm UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/2 "2021-10-26T12:38:55Z")

</div>

Don’t upload the media folder, it is basically a cache folder. It should get recreated automatically on the server. If it doesn’t, check your file/folder permissions.

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 26, 2021, 4:19pm UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/3 "2021-10-26T16:19:56Z")

</div>

Deleting the media-folder on the web-server didn’t help.  
Permissions of which files/folder do you mean an what permissions should they have?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 26, 2021, 5:25pm UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/4 "2021-10-26T17:25:52Z")

</div>

Hm, which thumb driver are you using? (Although svgs are not resizable and should be copied to the media folder independent of whether the driver works or not).

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 27, 2021, 6:04am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/5 "2021-10-27T06:04:52Z")

</div>

What is a thumb driver?  
And where can I find it?

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [October 27, 2021, 6:08am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/6 "2021-10-27T06:08:54Z")

</div>

> **[thumbs](https://getkirby.com/docs/reference/system/options/thumbs#thumbs-driver)**
>
> Set default configuration for thumbs

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 27, 2021, 6:15am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/7 "2021-10-27T06:15:14Z")

</div>

The /site/config/config.php does not contain anything about thumbs.  
But why should I care about it, isn’t it a task of Kirby?  
Why should there be a difference between my local server and the web-server?

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [October 27, 2021, 6:16am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/8 "2021-10-27T06:16:53Z")

</div>

By default, Kirby uses the GD library for manipulating images, but you can also use other like imagemagick or even custom ones.

It’s possible to have issues with this library on your server (local or remote), hence the question.

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 27, 2021, 6:34am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/9 "2021-10-27T06:34:34Z")

</div>

But in this case I should get an error-message on the web-server - no?

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 29, 2021, 10:53am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/10 "2021-10-29T10:53:05Z")

</div>

I just added this to /site/config/config.php

```
'thumbs' => [
    'driver' => 'im',
    'bin' => '/usr/local/bin/convert'
]

```

But it does not help.  
File/folder permission should be ok because after deleting /media it gets recreated (but only for pages not for images).

Any other idea?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 30, 2021, 7:19am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/11 "2021-10-30T07:19:53Z")

</div>

Is ImageMagick even installed on the server? Simply enabling it in the config will not help.

> [@Alain](#):
>
> it gets recreated (but only for pages not for images).

That probably means that the parent folders for the images are created. What about the .jobs folders and the .json job files for thumbs insides those folders? Are they created?

Having said that, an .svg file is not resizable, so the thumb driver should not be involved at all, but the file should simply be copied into the media folder.

Could you try the following e.g. in the home template on your server:

```auto
<?php

$file = $site->image(); // here I use the first image in the site, you can replace this with any other file.
Kirby\Cms\Media::publish($file, $file->mediaRoot());
?>

```

Then reload the home page in the browser.

With this example, you should get a copy of the site file in `/media/site/xxx-xxx/filename.

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 30, 2021, 7:53am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/12 "2021-10-30T07:53:06Z")

</div>

```auto
<?php

$file = $site->image(‘projekt-logo-start.svg’); // here I use the first image in the site, you can replace this with any other file.
Kirby\Cms\Media::publish($file, $file->mediaRoot());
?>

```

The above code snippet works, the ‘projekt-logo-start.svg’ file shows up.  
But what to do to show all the remaining images?

And yes .jobs folders have been created before and there are .json files in it.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 30, 2021, 8:02am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/13 "2021-10-30T08:02:55Z")

</div>

And when you delete the file in the file copy in media folder again and replace the above example code with

```auto
<?php echo $site->image(‘projekt-logo-start.svg’)->url() ?>

```

Is the file then recreated?

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 30, 2021, 8:11am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/14 "2021-10-30T08:11:17Z")

</div>

No, it only outputs the path on the frontsite.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 30, 2021, 8:21am UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/15 "2021-10-30T08:21:22Z")

</div>

Hm, which Kirby version are you using? Are you using any custom code (third party plugins, own extensions, models etc.)?

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 30, 2021, 12:05pm UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/16 "2021-10-30T12:05:38Z")

</div>

Kirby 3.5.6.  
Yes there are plugins:  
phpspreadsheet  
TCPDF

And a helper plugin (from you) for kirbytext raw

```auto
function ktRaw($content) {
  $text = kirbytext($content);
  return preg_replace('/(.*)<\/p>/', '$1', preg_replace('/<p>(.*)/', '$1', $text));
}

field::$methods['ktRaw'] = function($field) {
  return ktRaw($field->value);
};

```

And yes some own models, controllers, …

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [October 30, 2021, 2:10pm UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/17 "2021-10-30T14:10:03Z")

</div>

Since it seems to work localhost: What are the differences between you local setup and the remote server? Where are you hosting the site? When you update to the current 3.5.7.1 version, does the issue persist?

You could also try and upload a fresh (up-to-date) Starterkit to the server to find out if that works without issues.

---

<div class="post-metadata">

**Author:** ![Alain](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/alain/32/10270_2.png) [@Alain](https://forum.getkirby.com/u/Alain)\
**Post date:** [October 30, 2021, 8:47pm UTC](https://forum.getkirby.com/t/path-to-assets-broken-after-uploading-to-webserver/23787/18 "2021-10-30T20:47:03Z")

</div>

I tried now with Git by creating a remote repository on the hosting server instead of just copy the files to the server.  
Now it works 🙂  
I have no idea what I have done wrong before 🤔

Anyway, thanks for your patience and ultrafast, kind support!
