Laravel - Uploadifive not uploading


Laravel - Uploadifive not uploading

我试图实现Uploadifive插件到我的网站,但我没有看到上传的文件。我没看到任何错误。下面是我的代码:

html

<div class="form-group" id="queue">
                <label for="file">Add attachment</label>
                {{ Form::file("file", ["id" => "file_upload", "multiple" => true]) }}
                <a style="position: relative; top: 8px;" href="javascript:$('#file_upload').uploadifive('upload')">Upload Files</a>
            </div>

js

<script type="text/javascript">
$(document).ready(function() { 
    $('#file_upload').uploadifive({
      'auto' : true,
      'queueID' : 'queue',
      'uploadScript' : "/uploadfive/uploadifive.php",
      'onUploadComplete' : function(file, data) { console.log(data); }
    });;
});</script>
php

$uploadDir = "/public_html/myDomain.com/public/attachments/";
// Set the allowed file extensions
$fileTypes = array('jpg', 'jpeg', 'gif', 'png'); // Allowed file extensions
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
    $tempFile   = $_FILES['Filedata']['tmp_name'];
    $uploadDir  = $_SERVER['DOCUMENT_ROOT'] . $uploadDir;
    $targetFile = $uploadDir . $_FILES['Filedata']['name'];
    // Validate the filetype
    $fileParts = pathinfo($_FILES['Filedata']['name']);
    if (in_array(strtolower($fileParts['extension']), $fileTypes)) {
        // Save the file
        move_uploaded_file($tempFile, $targetFile);
        echo 1;
    } else {
        // The file type wasn't allowed
        echo 'Invalid file type.';
    }

在输出时,我得到"1"作为结果,这表明没有错误,但我在附件文件夹中找不到上传的文件。

我也试图找到附件文件夹使用public_path()功能,但后来我得到500 error。附件文件夹的权限设置为777

try:

$file = Input::file('file');
        $destinationPath = public_path().'/files';
        // If the uploads fail due to file system, you can try doing public_path().'/uploads' 
        $filename        = str_random(12);
        //$filename = $file->getClientOriginalName();
        //$extension =$file->getClientOriginalExtension(); 
        $upload_success  = Input::file('file')->move($destinationPath, $filename);
        if( $upload_success ) {
           return Response::json('success', 200); 
        } else { 
           return Response::json('error', 400); 
        }