0
因此,當在本地運行文件時,它的工作方式如何,但是當我在實時站點上運行它時,它不會以相同的方式執行。DropZone.JS不在現場工作
Dropzone.prototype.defaultOptions = {
url: null,
method: "post",
withCredentials: false,
parallelUploads: 2,
uploadMultiple: false,
maxFilesize: 3,
paramName: "file",
createImageThumbnails: true,
maxThumbnailFilesize: 10,
thumbnailWidth: 100,
thumbnailHeight: 100,
maxFiles: 6,
params: {},
clickable: true,
ignoreHiddenFiles: true,
acceptedFiles: "image/jpeg",
acceptedMimeTypes: null,
autoProcessQueue: true,
addRemoveLinks: false,
previewsContainer: null,
dictDefaultMessage: "Drop files here to upload",
dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
dictInvalidFileType: "You can't upload files of this type.",
dictResponseError: "Server responded with {{statusCode}} code.",
dictCancelUpload: "Cancel upload",
dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
dictRemoveFile: "Remove file",
dictRemoveFileConfirmation: null,
dictMaxFilesExceeded: "You can not upload any more files.",
...
這些工作在本地網站上,但似乎沒有在現場工作。它不能識別jpeg的自定義文件以及最大3Mb。
<?php
if ($_GET['audit_id']) {
$id = $_GET['audit_id'];
$ds = DIRECTORY_SEPARATOR; //1
$storeFolder = 'uploads'; //2
//count how many files are in director
$directory = 'uploads/';
$files = glob($directory . 'audit'.$id.'_image*.jpg');
$count = 0;
if ($files !== false) {
$count = count($files) + 1;
}
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name']; //3
$rename = explode('.', $_FILES['file']['name']);
$nameString = 'audit'.$id.'_image'.$count.'.'.$rename[1];
//only allow certain image files
$allowed = array( 'jpg'
);
if (in_array($rename[1], $allowed)) {
$targetPath = dirname(__FILE__) . $ds. $storeFolder . $ds; //4
$targetFile = $targetPath. $nameString; //5
move_uploaded_file($tempFile,$targetFile); //6
}
}
} else {
echo 'fatal error.';
}
?>
它無法識別設置的選項,並且不會在活動網站上上傳。這可能是由於dropzone.js沒有正確讀取..?
現在文件權限已被最大化,以確保它的工作,所以我不能看到它是這樣的。