当我把sql语句的数据库来存储blueimp / jQuery的,文件上传?我把、语句、文件上传、数据库

2023-09-10 18:14:33 作者:薄荷味的猫

我使用 Blueimp / jQuery的,文件上传多个图片上传,当我把sql语句存储在数据库中的图片文件名作为blueimp / jQuery的,文件上传?

I'm using Blueimp/jQuery-File-Upload for multiple image uploads, Where I put the sql statement to store image file name in database for blueimp/jQuery-File-Upload ?

推荐答案

在你的blueimp_root>服务器>的PHP文件夹,打开 upload.class.php 并添加$在公共职能门柱内侧C $ C()头('有所不同:接受')前右;

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.

您可以使用 $信息[$ i] - &GT;网址来获取上传文件的网​​址以及

You may use $info[$i]->url to get the uploaded file's url as well.

下面是完整的code与我原来的查询,如果您需要更多的参考: HTTP://$c$cpaste.net/ p84dao

Here's the full code with my original query if you need more reference: http://codepaste.net/p84dao