I'm trying to move images in php but it's not working.
Code: Select all
<?php
if (isset($_POST['submit'])) {
if ((($image_type == 'image/jpg') || ($image_type == 'image/pjpeg') || ($image_type == 'image/bmp') || ($image_type == 'image/gif'))
&& ($image_size > 0) && ($image_size <= MYWORLD_MAXFILESIZE)) {
// Move file to upload target folder
$target = MYWORLD_UPLOADPATH . $image;
if (move_uploaded_file($_FILES['screenshot']['tmp_name'], $target)) {
echo 'Image uploaded successfully';
} else {
$errors[] = 'Failed to move the uploaded file';
echo 'Failed to move the uploaded file';
}
} else {
$errors[] = 'Only jpeg, bmp or gif files allowed to a maximum size of 1mb';
echo 'Only jpeg, bmp or gif files allowed to a maximum size of 1mb';
}
}
?>
Any help would be much appreciated