Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
多输入类型文件元素jquery ajax php mysql_Php_Jquery_Mysql_Ajax_Pdo - Fatal编程技术网

多输入类型文件元素jquery ajax php mysql

多输入类型文件元素jquery ajax php mysql,php,jquery,mysql,ajax,pdo,Php,Jquery,Mysql,Ajax,Pdo,我想在我的项目中放入2个输入类型的文件,这意味着我希望能够在一个插入查询中上载两次。我正在寻找样品,但还没有找到。我找到的唯一相关的文章是,但没有说太多。当我说多输入文件时,我的意思是这样的 -第一个输入文件 -第二个输入文件 我想做的是在一个输入文件中选择图像,然后在另一个输入文件中再次选择其他文件(例如pdf),并能够在单独的表中插入这些文件。我使用ajax将信息从html传递到服务器端。我使用pdo(php),我的数据库是mySQL。 任何想法都值得赞赏。举个例子最有帮助。特别是关于如何确

我想在我的项目中放入2个输入类型的文件,这意味着我希望能够在一个插入查询中上载两次。我正在寻找样品,但还没有找到。我找到的唯一相关的文章是,但没有说太多。当我说多输入文件时,我的意思是这样的

-
第一个输入文件

-
第二个输入文件

我想做的是在一个输入文件中选择图像,然后在另一个输入文件中再次选择其他文件(例如pdf),并能够在单独的表中插入这些文件。我使用ajax将信息从html传递到服务器端。我使用pdo(php),我的数据库是mySQL。 任何想法都值得赞赏。举个例子最有帮助。特别是关于如何确定哪个
$\u文件
是哪个输入文件的
。如果我能确定这一点,我想我可以将它插入到服务器端的特定表中

更新

如何从2个输入类型文件元素插入文件(两者都可以有多个文件)

我希望这能解决我的问题

Array
(
    [file1] => Array
        (
            [name] => MyFile.txt (comes from the browser, so treat as tainted)
            [type] => text/plain  (not sure where it gets this from - assume the browser, so treat as tainted)
            [tmp_name] => /tmp/php/php1h4j1o (could be anywhere on your system, depending on your config settings, but the user has no control, so this isn't tainted)
            [error] => UPLOAD_ERR_OK  (= 0)
            [size] => 123   (the size in bytes)
        )

    [file2] => Array
        (
            [name] => MyFile.jpg
            [type] => image/jpeg
            [tmp_name] => /tmp/php/php6hst32
            [error] => UPLOAD_ERR_OK
            [size] => 98174
        )
)