move_uploaded_file wrote:
bool move_uploaded_file ( string $filename , string $destination )
This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.
This function moves $filename to $destination. It returns boolean, true on success false on failure.
mysqli::real_escape_string wrote:
string mysqli::escape_string ( string $escapestr )
This function takes a string as paramter, but you feed it a boolean (as you can see from the description of move_uploaded_file).
More info from move_uploaded_file page.
handling file uploads wrote:
Table of Contents
* [url=http://se.php.net/manual/en/features.file-upload.post-method.php]POST method uploads[/url]
post method uploads wrote:
The contents of $_FILES from the example form is as follows. Note that this assumes the use of the file upload name userfile, as used in the example script above. This can be any name.
$_FILES['userfile']['name']
The original name of the file on the client machine.
$_FILES['userfile']['type']
The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
$_FILES['userfile']['size']
The size, in bytes, of the uploaded file.
$_FILES['userfile']['tmp_name']
The temporary filename of the file in which the uploaded file was stored on the server.
(...)
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
In this part
$uploads_dir = 'http://localhost/Blean_Photos/images';
$uploads_dir is a URI, but you want a server path: /path/to/webroot/Blean_Photos/images/
$data = $dbLink->real_escape_string(move_uploaded_file($name,$uploads_dir);
Looking at the name, this is nothing but a leftover from when you inserted the image as a blob. You don't need to deal with image data anymore.