I want to save gif type image in mySQL database without post method.
<form action="add_file.php" method="post" enctype="multipart/form-data">
<input type="file" name="uploaded_file"><br>
<input type="submit" value="Upload file">
</form>
I want to upload file by php code only. for example:
// Gather all required data
$name = $File_Name;
$mime = $File_Type;
$data = $File_Data;
$size = $File_Size;
// Create the SQL query
$query = "
INSERT INTO `file` (
`name`, `mime`, `size`, `data`, `created`
)
VALUES (
'{$name}', '{$mime}', {$size}, '{$data}', NOW()
)";
I have more then 21,0000 image in my local. I want to save image in loop.
Upload the files using FTP, then write a little PHP script that you run only once
that loops through the folder and adds the images to the database.
Make sure to remove the php file after it is done, so that you don’t run it again accidentally 😉