Inserting Image into MYSQL

[php]58.7KB, 223KB,

Hi! I have a two basic extension file for Uploading and Inserting Image in MySQL. First I have a ADD.HTML File & Second INSERT.PHP, ADD.HTML provide form input box for image upload, it goes as below:


Form upload to DataBase

Second, I have INSERT.PHP to insert image to MySQL Database, which code is as below:

<?php // Create MySQL login values and // set them to your login information. $username = "root"; $password = "****** "; $host = "localhost"; $database = "binary"; // Make the connect to MySQL or die // and display an error. $link = mysql_connect($host, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } // Select your database mysql_select_db ($database); // Make sure the user actually // selected and uploaded a file if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { // Temporary file name stored on the server $tmpName = $_FILES['image']['tmp_name']; // Read the file $fp = fopen($tmpName, 'r'); $data = fread($fp, filesize($tmpName)); $data = addslashes($data); fclose($fp); // Create the query and insert // into our database. $query = "INSERT INTO tbl_images "; $query .= "(image) VALUES ('$data')"; $results = mysql_query($query, $link); // Print results print "Thank you, your file has been uploaded."; } else { print "No image selected/uploaded"; } // Close our MySQL Link mysql_close($link); ?>

Everything is right, i can upload image to my binary database with table tbl_images, but i can only upload image of size <= 58.7 KB & when i upload image with size 223 KB it display message as:

No image selected/uploaded

[size=14pt]How to increase image size in above code? Please help me!.[/size]


Sponsor our Newsletter | Privacy Policy | Terms of Service