# Image upload not working

**URL:** https://forum.getkirby.com/t/image-upload-not-working/24709
**Category:** Questions
**Tags:** v3
**Created:** [February 10, 2022, 6:07pm UTC](https://forum.getkirby.com/t/image-upload-not-working/24709 "2022-02-10T18:07:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sts](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sts/32/8983_2.png) [@sts](https://forum.getkirby.com/u/sts)
#### Post date: [February 10, 2022, 6:07pm UTC](https://forum.getkirby.com/t/image-upload-not-working/24709/1 "2022-02-10T18:07:22Z")

</div>

Hi,

I noticed today that when I try to upload images on the server, there is an error message in many, but not all of my projects as follows:

 ![Bildschirmfoto vom 2022-02-10 18-59-07](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/e/e46b1ac057866fb842e43c4387ffdc1d1f6d2fe0.png)

This message appears when I try to upload an image by any means (file picker or drag&drop) independent from the image file (I tried several), but only on the server. I have never seen this locally for the exactly same projects with exactly the same code. It’s not even happening consistently in all projects.  
Does anyone have a clue where this might come from?

It’s happening for PHP versions 7.4, 8.0 and 8.1 and Kirby version 3.6.0, 3.6.1 and 3.6.2. When the error is there, I couldn’t find a combination, where the error disappears. In another project, file uploads are working fine with the same combinations.  
I also checked the htaccess files and there is nothing suspicious. In fact I didn’t adjust these for long times.  
The error may be there for a long time as I hardly use the panel online at all.

Thanks in advance!

---

<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: [February 10, 2022, 6:20pm UTC](https://forum.getkirby.com/t/image-upload-not-working/24709/2 "2022-02-10T18:20:30Z")

</div>

Can you find a stack trace in the browser console? Obviously the url passed to the HTML::img() method is null which it may not be if the file exists. I wonder if this is some sort of permission issue, but that’s just groping around.

---

<div class="post-metadata">

### Author: ![sts](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sts/32/8983_2.png) [@sts](https://forum.getkirby.com/u/sts)
#### Post date: [February 10, 2022, 10:06pm UTC](https://forum.getkirby.com/t/image-upload-not-working/24709/3 "2022-02-10T22:06:02Z")

</div>

Thanks for the hint. Indeed there is an internal server error (500), when I do the upload. So I thought it might really be a permission issue, but that is not the case (it seems). Folder permissions are set to 755 and I even tried 777 for testing, but the internal server error remained.

I can see that the file is uploaded to a /tmp folder on the server from where it should probably be moved to the target folder after successful upload. But this doesn’t happen. So this does point towards a permissions error in the target folder, doesn’t it? But I thought I had excluded that with the previous test.

Any clues?

---

<div class="post-metadata">

### Author: ![sts](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sts/32/8983_2.png) [@sts](https://forum.getkirby.com/u/sts)
#### Post date: [February 11, 2022, 10:48am UTC](https://forum.getkirby.com/t/image-upload-not-working/24709/4 "2022-02-11T10:48:57Z")

</div>

OK, I found the problem. It was due to one of my plugins.  
There I echoed the `$upload` variable, which is of type `Kirby\Filesystem\File` and breaks when echoing (I must have introduced this error when adjusting the hooks for Kirby 3.6+). The problem was solved by echoing `$upload->filename()` instead. Strangely, there was no PHP error logged in this case while other PHP errors are logged. So it took me some time.

Thanks for the support @texnixe as always!
