我正在使用Blueimp / jQuery-File-Upload进行多个图像上传,在哪里我将sql语句存储在数据库中的图像文件名用于blueimp / jQuery-File-Upload?
Inside your blueimp_root > server > php folder, open the upload.class.php
and add your code inside the public function post()
right before the header('Vary: Accept');
:
$con = mysql_connect("localhost","root","root");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("zeeshan", $con);
for($i=0; $i<count($info); $i++) {
if (!isset($info[$i]->error)) {
$filename = $info[$i]->name;
mysql_query("INSERT INTO zeeshan.scroll_images (scroll_images.name, scroll_images.order) VALUES ('$file_name', 0)");
}
}
This will iterate through all uploads checking if they were successful and inserting their filenames into the database.
You may use $info[$i]->url
to get the uploaded file's url
as well.
Here's the full code with my original query if you need more reference: http://codepaste.net/p84dao
go to server/php/upload.class.php line: 313, add a new line and write:
$file_path = $this->options['upload_dir'].$file_name;
and echo this, it is the path of uploaded file, if it is true, write you sql query there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.