Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to insert image into mysql database?
    text
    copied!<p>i am trying to get the uploaded image inserted into mysql database but i get this error msg. help please. here is the error i get </p> <pre><code>Array ( [name] =&gt; Zonsondergang.jpg [type] =&gt; image/jpeg [tmp_name] =&gt; /tmp/phpU9qSru [error] =&gt; 0 [size] =&gt; 71189 ) </code></pre> <p>data/Zonsondergang.jpg test file successfully loaded</p> <blockquote> <p>Warning: file_get_contents(/tmp/phpU9qSru) [function.file-get-contents]: failed to open stream: No such file or directory in /home/meer/domains/skyup.nl/public_html/upload_Class/upload.php on line 68 Error! Failed to insert the file1</p> </blockquote> <p>here is my code for uploading image and inserting the image into database</p> <pre><code>include('../inc/con_inc.php'); // Defining Class $uploaded = new upload; // Set Max Size $uploaded-&gt;set_max_size(350000); // Set Directory $uploaded-&gt;set_directory("data"); // Set Temp Name $uploaded-&gt;set_tmp_name($_FILES['file']['tmp_name']); // Set file size, $_FILES['file']['size'] is automaticly get the size $uploaded-&gt;set_file_size($_FILES['file']['size']); // Set File Type, $_FILES['file']['type'] $uploaded-&gt;set_file_type($_FILES['file']['type']); // Set File Name, $uploaded-&gt;set_file_name($_FILES['file']['name']); // Start Copy Process $uploaded-&gt;start_copy(); $name=($_FILES['file']['name']); $data=(file_get_contents($_FILES['file']['tmp_name'])); $query="INSERT INTO download(name,data) VALUES('$name','$data')"; if ($result){ echo 'Success! Your file was successfully added!'; }else{ echo 'Error! Failed to insert the file' ; $result=mysql_query($query) or die ('query fout'); } </code></pre> <p>here is the stracture of table:</p> <pre><code>create table download ( id int primary key not null auto_increment, name varchar(60), data longblob) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload