我有一个带有无限添加文件的按钮上传它工作正常。但我上传多个文件时出错。文件是分开的。我得到了整个数组的所有文件,但abaqusPath = "C:\\Abaqus\\Commands\\abaqus.bat "
args = AbaqusPath + "python test.py"
subprocess.call(args)
中出现了一些问题:
$this->upload->do_upload()
我阅读并尝试了multiple-files-upload-array-with-codeigniter-2-0。它与我的问题相似,但它没有奏效。
is_uploaded_file() expects parameter 1 to be string, array given
这个html文件调用Javascript,它看起来像下面的图片。
现在我的职能是,
<div class="form-group">
<label>Menu</label>
<div id="text">
<div class="abc">
<input class="input_file" name="userfile[]" type="file"/>
<input class="add_input" type="button" id="add-file-field" name="add" value="Add Photo" />
</div>
</div>
<input class="" type='hidden' name="action" value="uploadfiles" />
<input type="hidden" value="Upload File" />
</div>
}
我收到了数组中的文件,但 $ this-&gt; upload-&gt; do_upload()
出现了问题文件数组
public function insert_gallery()
{
isset($_REQUEST['action']) ? $action = $_REQUEST['action'] : $action = '';
if($action == 'uploadfiles')
{
//define where the files will be uploaded
echo "<pre>";
print_r($_FILES);
$x=0;
foreach ($_FILES['userfile']['name'] as $key => $value)
{
echo $image_name = $_FILES['userfile']['name'][$key];
echo $unique_name = time().$image_name;
$x++;
$config = array(
'upload_path' => "./public/business_gallery",
'allowed_types' => "gif|jpg|png|jpeg|pdf",
'overwrite' => TRUE,
'max_size' => "2048000", // Can be set to particular file size
'max_height' => "768",
'max_width' => "1024",
);
print_r($config);
$this->load->library('upload',$config);
if($this->upload->do_upload())
{
echo 1;
}
else
{
echo 0;
}
}
}