File not found: /home/blablabla/profile-512x.jpg when changing profile picture format

Hi! I’m having a bit of an issue with the user pic upload.

Basically, if you upload a file that’s the same format as the pic you uploaded previously, it’s fine. But if you switch to a PNG file after uploading a JPG file for example, it gives you this error. It uploads the file regardless.

It looks like it’s saving JPG files in a folder called 98344cb37d-1600032687 and PNG files in 44cb0f892c-0 (at least in my current case), which is why it can’t find it - it’s looking in the folder for the old format.

Is there a way to get around this error just to tidy things up for the user without restricting the file type somehow?

Thanks in advance,
Phil

I guess you are talking about the change method. I think that is in line with file replacing in sections. Changing/replacing only works with files with the same extension. So if you want to upload a file with another extension, you would have to delete the file first, then upload a new file.

Cheers for the response! Although I’m not sure I worded my original question very clearly - this isn’t a feature I’m trying to implement, it’s an issue with the Kirby core that’s present in the plainkit.

In the “Your account” section, if you try and upload a new profile picture that’s a different file type than the picture you uploaded previously, it throws up this error and doesn’t refresh the page, so it looks like the image hasn’t successfully uploaded to the user until they refresh the page.

After having a look through the source code for the JS attached to that button, think I might be out of my depth trying to fix it myself. You reckon this is worth reporting as a bug?

One more question while I have your ear: When does the custom panel JS run if I do that through the config.php file, just in case I can try to implement a fix myself? Does it run before or after the page loads?

I could reproduce it on a 3.4.2 Starterkit, that is definitely a bug that should be reported, yes. Either the new file should not be uploaded at all, or the image should be properly replaced.

Thanks for your help, I’ve posted that on the github :slight_smile: