trying to upload images - /tmp folder permissions


Mar 18, 2013
cPanel Access Level
Root Administrator
First of all hi!
I know there are many threads about this but I need help...
On my website I have an admin section where I post some text to an database and upload one image to the server...
Here's the problem:
Warning: move_upload_file(evenimente/images/test.jpg):failed to open stream: Permission denied in file/path on line ...
Warning: move_upload_file: Unable to move '/tmp/phpsTjYQC' to 'evenimente/images/test.jpg' in file/path on line ...
My code
$image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name= addslashes($_FILES['image']['name']);
$sizes = array();
$sizes['100'] = 100;
list(,,$type) = getimagesize($_FILES['image']['tmp_name']);
$type = image_type_to_extension($type);
move_uploaded_file($_FILES['image']['tmp_name'], 'evenimente/images/'.$prefix.$type);
$t = 'imagecreatefrom'.$type;
$t = str_replace('.','',$t);
$img = $t('evenimente/images/'.$prefix.$type);
foreach($sizes as $k=>$v)

	                $width = imagesx( $img );
			$height = imagesy( $img );
			$new_width = $v;
			$new_height = '147';
                        $tmp_img = imagecreatetruecolor( $new_width, $new_height );
			imagealphablending( $tmp_img, false );
			imagesavealpha( $tmp_img, true );
			imagecopyresampled( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );

			$c = 'image'.$type;
			$c = str_replace('.','',$c);
			$c( $tmp_img, 'evenimente/images/th/'.$prefix.$type );
The code was made in case i needed to make more thumbnails of the uploaded image.
The permission on tmp folder 755


If you need any info I'm here :)
For the record I'm logged in as an database user, not root...
The code works on localhost using wamp server
Last edited: