Jump to content

Image Upload broken?


Lars282
 Share

Recommended Posts

Hey!

I am not sure since when, but it seems that the image upload on my site is broken. I can no longer upload image through the admin. Everything appears to be fine, but in the end the image has not been added.

I have checked for the images that are already online: it seems they are all missing the file ending, ie they are called .../site/assets/files/1096/phpvwmbuw.

Also, wenn I try to use image->width(500)->url, it results in an error that I am trying to use width on a non object.

I have an image upload form on my website. When uploading through this form, the images are successfully uploaded, but without the file ending. When I then try to access the page for the first time in the admin, it shows this error: phphitkhd.0x100. is an unsupported image type

Subsequent views of the admin page are fine, and it shows all fields and no error.

The 'show thumbnail in admin' box is ticked for the image field.

What is wrong? How can I fix it?

Everything else seems to be working fine.

Thanks for the help,

Lars

//edit: I have already replaced the wire folder with the latest, but this did not fix the issue. I had thought that this should at least fix the issues I have on the admin side, but it didn't.

Edited by Lars282
Link to comment
Share on other sites

Since there is a common problem between admin and front-end with the files missing extensions, that seems to indicate there is another factor at play beyond ProcessWire. What is the source of your upload script on the front-end? Is this self-built or something else? What 3rd party modules do you have installed?

Link to comment
Share on other sites

It's a self-built script, but it was certainly working fine. Also, since it is a page, independently of whether that is working correctly, it should be possible to upload through the admin?

I have already uninstalled all self-built modules.

Link to comment
Share on other sites

It sees to be some strange mod_sec and safe_mode settings that have recently been changed by my hosting provider. Hopefully, they will resolve this soon.

On another note, what should the chmod settings be for the assets folder and subfolder? And files?

In the config it has

$config->chmodDir = "0777";
$config->chmodFile = "0666";

Do folders really need 777? And files 666?

Link to comment
Share on other sites

On another note, what should the chmod settings be for the assets folder and subfolder? And files?

It really depends on the server. This is a question for your hosting provider. In terms of ProcessWire, these particular permissions apply only to files in /site/assets/. The default permissions are going to work anywhere, but are not safe in shared environments that aren't completely jailed from one another. I don't know anything about your hosting environment, so can't suggest without more information. But one thing you can do is to test different permissions to find what will work. If 0700 for dirs and 0600 for files will work, that might be a good place to stay. But unless your server is using suexec, that won't work. If that doesn't work, see if 0755 for dirs and 0644 for files will work. This is a starting point, but you want to find the most secure solution for your server environment.

The best way to check if something works is to create a page with a files field on it and upload a file. If the file upload does not work, then you've likely not found the right permissions. Once you have found the right permissions, make sure to go back and apply it to directories/files that already exist in /site/assets/, including the /site/assets/ directory itself. This is starting to sound like a good idea for a new module...

The most common ProcessWire hosting environment is a dedicated one (server or VPS.) If that is also your environment, then you won't have to worry so much about locking down the permissions. But if you are using a low budget/shared hosting environment, then tweaking the permissions is definitely a good idea. Either way, your hosting provider will be the best to recommend what is right with their servers.

  • Like 2
Link to comment
Share on other sites

  • 4 years later...

When I uploaded any image it uploaded to "/site/assets/files/xxxx" path  with permission  600 and return 403 forbidden when I tried yo access it or edit it

 my config file now like this:

$config->chmodDir = '0755'; // permission for directories created by ProcessWire
$config->chmodFile = '0644'; // permission for files created by ProcessWire 

But after I upload new image I found 2 version of it : 

  1. one named like :"orginal.0x260.jpg" with permission  644 
  2. another one with orginal name with  permission 600

Sorry but I'm new to processwire 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...