我想把2个输入型文件在我的项目,这意味着我希望能够在一个插入查询上传两次。我正在寻找样品,但我还没有找到。我找到的唯一相关文章是this ,但没有说太多。当我说多个输入文件时,我的意思是这样的。
<input type="file" name="file1"/> - first input file
<input type="file" name="file2"/> - second input file
我想要发生的是选择一个输入文件中的图像,然后再次选择另一个输入文件中的其他文件(例如pdf),并能够将这些文件插入到单独的表中。我使用ajax将信息从html传递到我的服务器端。我使用pdo(php),我的数据库是mySQL。任何想法都是值得欣赏的。有一个例子会最有帮助。尤其是关于如何确定哪个$_file是from which input file。如果我能确定这一点,我想我就能把它插入到服务器端的特定表中
UPDATE
如何从2个输入类型的文件元素插入文件(两者都可以有多个文件)
发布于 2015-06-17 16:25:26
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
)
)来自here的我希望这能解决我的问题
https://stackoverflow.com/questions/30885836
复制相似问题