Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Failed to move uploaded file to target destination when editing Thumbnail pic

I get the following error when i edit and save thumbnail picture:

Failed to move uploaded file to target destination 
(/home/user/public_html/site/public/uploads/userpics/044/pJRSOVGDQB5LO.jpg).

It's not a permission problem, i already tried setting up a full 777 permission uploads directory and it's parents. any idea?

Thanks,

Comments

  • So in that case you look in the Vanilla source and try to figure out why it's giving you that exact error message. You can try and search for that exact text in the source.

    There was an error rendering this rich post.

  • Kind of obvious question but does the folder userpics have the same permission?

  • @UnderDog Thanks for the hint. I found this:

     if (!$Handled) {
             $Target = PATH_UPLOADS.'/'.$Parsed['Name'];
             if (!file_exists(dirname($Target)))
                mkdir(dirname($Target));
    
             if (!move_uploaded_file($Source, $Target))
                throw new Exception(sprintf(T('Failed to move uploaded file to target destination (%s).'), $Target));
          }
          return $Parsed;
    

    But i have know idea what that mean :) i'm kida new for PHP :)

    @HalfCat Yeah userpics have the same permission 777

  • any update? Exact problem

  • businessdadbusinessdad Stealth contributor MVP

    What permissions do you have on directory /home/user/public_html/site/public/uploads/userpics/044?

  • The problem is that Vanilla creates a new directory for every new thumbnail, and that directory has improper permissions. There is no way to fix this by changing the permissions on the directory since its only used for the one image.

  • 422422 Developer MVP

    you can apply permissions to sibling folders within userpics tho

    There was an error rendering this rich post.

  • businessdadbusinessdad Stealth contributor MVP

    @DirtyDog said:
    The problem is that Vanilla creates a new directory for every new thumbnail, and that directory has improper permissions.

    That sounds odd to me. As far as I know, the directory is created by the User which is assigned to the Web Server, who is then its owner. Unless the server is configured with a very strict default permission mask (umask), the directory should at least have write permissions for the owner. For example, my server creates them with permissions set to 755, which would allow the owner to write in it.

    @achu, could you please verify the permissions of the directory I indicated? That could shed some light on what's happening.

  • KhasckKhasck New
    edited May 2013

    Change line 222 at ./library/core/class.upload.php from
    if (!move_uploaded_file($Source, $Target))
    to
    if (!copy($Source, $Target))

    The file is already present on the server, we're not trying to move an uploaded file, we're just copying the one that exists.

Sign In or Register to comment.