我已经有一个上传多个文件的系统(HTML,JS,PHP)。
现在,我有一个输入倍数。但是我想用Drag&使用$_FILES["uploadfile"]
删除而不更改系统PHP是否可能?
HTML
<input type="file" name="uploadfile[]" multiple="" style="position: absolute; margin: -5px 0px 0px -175px; padding: 0px; width: 220px; height: 30px; font-size: 14px; opacity: 0; cursor: pointer; display: none; z-index: 2147483583; top: 83px; left: 333px;">
<div id="dropzone" style="border: 3px solid #DDD; width: 400px; height: 400px;"></div>
PHP
$uploaddir = 'uploads/';
$files = array();
foreach ($_FILES["uploadfile"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$path = $uploaddir . basename($_FILES['uploadfile']['name'][$key]);
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'][$key], $path)) {
$files [] = array (
'title' => $_FILES['uploadfile']['name'][$key],
'url' => $path,
'size' => $_FILES['uploadfile']['size'][$key]
);
}
}
}
echo json_encode($files);