phpajaxpermissionshttp-status-code-401photo-upload

php and ajax - upload base64 photo and return link to edit


I've tried to make this:

I've done this pretty far and it works fine on my local Apache. But when I've moved it to remote web-hosting (I dont have access to shell) the first ajax request (when user submit the photo) returns 401 Unauthorized. I searched for wrong files permissions but I'm not sure if it's problem of photo.php's permissions or the uploaded image's permissions. I've set 0650 to all directories.

Captured request: http://netbox.wayo.cz/401unauthorized.PNG

Here is code that saves the photo:

if($image = imagecreatefromstring($content))
{
     // save full-size photo
     if($photo = imagejpeg($image,$file_path,$control->get_config('upload_photo_quality')))
     {  
        // get photo params
        list($width,$height,$type,$attr) = getimagesize($file_path);

        // create photo thumbnail
        $thumb_name = uniqid().'.png';
        $thumb_path = DIR_DATA.'thumbs/'.$thumb_name;
        imagepng($image,$thumb_path,$control->get_config('upload_photo_compression'));

Solution

  • you must Set 654, in 650 public user can not access the directory and inner File if You Request For PHP Must Set 655 that allow user to Execute PHP file