HTML code:
<input type="file" name="files[]" multiple="multiple" id="photo" >
PHP code:
$query1="insert into imgtab values('".$ka."','".addslashes(file_get_contents($_FILES['files']['name'][$i]))."')";
Error:
Warning: file_get_contents(Screenshot (5).png): failed to open stream: No such file or directory in C:\xampp\htdocs\q.php on line 16
How can I solve this error?
Try using file_get_contents($_FILES['files']['tmp_name'][$i])
instead since ['name']
is a reference to the uploaded file name, not the file location. It is also bad practice to store files in the database. So you'd best use move_uploaded_file(...) then store the location to your database rather than the actual file contents.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments