2015-06-05 75 views
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没有正确读取..?

现在文件权限已被最大化,以确保它的工作,所以我不能看到它是这样的。

回答

0

原来,它只是需要几个小时才能真正更新,上面的代码工作。