Here are the error codes for file upload:
http://php.net/manual/en/features.file-upload.errors.php
Value: 0; There is no error, the file uploaded with success.
You should change at the end of script.
Something like this
$query = "INSERT INTO `images` (`name`, `mime`, `size`, `data`, `created`, `image_path`, `gallery_type_id`)
VALUES ('{$name}', '{$mime}', {$size}, '', NOW(), '{$image_path}', '{$gallery_type}')";
$dbLink->query($query);
}else {
echo 'File could not be saved (move_uploaded_file)';
}
}else{
echo 'Upload Error! A file was not sent!';
}
}
// Echo a link back to the main page
echo '<p>Click <a href="member-index.php">here</a> to go back</p>';
?>
One other common issue.
Say there is one image in upload directory: mypic.jpg
And so someone upload another image with same name.
I think what happens is the first image will be overwritten.
There can not be 2 images with same name.
To avoid this we may test if there is already one image mypic.jpg
and rename the other one.
Maybe call it mypic2.jpg when we move_uploaded_file()
To check if an image with that name already is in /images/
we can use [man]file_exists/man