I am having a user's profile page in which user uploads his profile picture from file dialog..
when the file is moved to my local server's folder it gets permission as 0644 only..
but I want to resize this image before getting uploaded into server...
And for this I need permission as 0777 to edit it...
How should I do it..
here is my code for move and resize
$upload_dir = './images';
$tmp = $_FILES["img"]["tmp_name"];
$names = $_FILES["img"]["name"];
$res=$moveR=move_uploaded_file($tmp, "$upload_dir/$names");
$a="./images/".$names;
list($width, $height) = getimagesize($a);
$newwidth = "300";
$newheight = "200";
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($a);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb, $a, 100);
Thanks in advance..
You need to run this on the files:
chmod ($filepath, 0777);
in your case probably:
chmod("$upload_dir/$names",0777);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With