I'm getting error in uploading image to directory folder named images
. Though I created a folder images
.
Error Occur
1. Warning: move_uploaded_file(images/Rachel Leigh Cook.jpg): failed to open stream:
2. Permission denied in /usr/home/mer/public_html/salico/ZNote/php/image_upload_do.php
3. Unable to move '/var/tmp/phpGV5fVF' to 'imagesRachel Leigh Cook.jpg' in
/usr/home/mer/public_html/salico/ZNote/php/image_upload_do.php
My code
$upfile = ( isset( $_FILES['userfile'] ) ) ? $_FILES['userfile'] : '' ;
if ( is_array( $upfile ) ) {
$file_name = $upfile['name'];
$file_temp = $upfile['tmp_name'];
$dir_file = 'images/'.$file_name;
if ( is_uploaded_file( $file_temp ) ) {
if ( move_uploaded_file( $file_temp, $dir_file ) ) {
echo 'Successfully Uploaded';
} else {
echo 'Failed to upload';
}
}
}
I think there is nothing wrong in my code. Do I need to edit the php.ini
file?