How to change image permission with PHP and chmod? -
as want display uploaded images on website message: "you don't have permission access /funproject/uploads/328/20.jpg on server".
i had problem before , solved using chmod
somehow deleted solution , can't create now.
i got function that:
function upload_image($image_temp, $image_ext, $album_id) { $album_id = (int)$album_id; mysql_query("insert `images` values ('', '".$_session['user_id']."', '$album_id', unix_timestamp(), '$image_ext')"); $image_id = mysql_insert_id(); $image_file = $image_id.'.'.$image_ext; move_uploaded_file($image_temp, 'uploads/'.$album_id.'/'.$image_file); create_thumb('uploads/'.$album_id.'/', $image_file, 'uploads/thumbs/'.$album_id.'/'); }
what have tried (and doesn't work):
mysql_query("insert `images` values ('', '".$_session['user_id']."', '$album_id', unix_timestamp(), '$image_ext')"); chmod($image_file, 0755);
how can alter permission of uploaded image using chmod
in function?
that worked!
mysql_query("insert `images` values ('', '".$_session['user_id']."', '$album_id', unix_timestamp(), '$image_ext')"); chmod("/somedir/uploads", 775);
php chmod
No comments:
Post a Comment