Laravel 5:FineUploader - 上传目录不可写

时间:2015-08-26 14:16:29

标签: php laravel-5 fine-uploader

我正在使用Laravel 5,我正在尝试使用FineUploder。 这是我用过的东西

PHP-Traditional

首先我有 VerifyCsrfToken 错误并作为临时注释

\App\Http\Middleware\VerifyCsrfToken::class,

来自

App/Http/Kernel.php

CsrfToken错误消失了!

现在我“上传目录不可写”错误。

我的路线

Route::resource('endpoint','FineUploaderController');

我的FineUploaderController

public function store(Request $request)
{
     // dd('store');
     return view('fineupload.endpoint');
}

我在公共文件夹中的上传文件夹

/uploads/receiptuploads

和endpoint.php

if ($method == "POST") {
header("Content-Type: text/plain");

// Assumes you have a chunking.success.endpoint set to point here with a query parameter of "done".
// For example: /myserver/handlers/endpoint.php?done
if (isset($_GET["done"])) {
    $result = $uploader->combineChunks("/uploads/receiptuploads");
}
// Handles upload requests
else {
    // Call handleUpload() with the name of the folder, relative to PHP's getcwd()
    $result = $uploader->handleUpload("/uploads/receiptuploads");

    // To return a name used for uploaded file you can use the following line.
    $result["uploadName"] = $uploader->getUploadName();
}

echo json_encode($result);
}
// for delete file requests
else if ($method == "DELETE") {
    $result = $uploader->handleDelete("/uploads/receiptuploads");
    echo json_encode($result);
}
else {
    header("HTTP/1.0 405 Method Not Allowed");
}

?>

1 个答案:

答案 0 :(得分:0)

简单的解决方案:您需要使“/ uploads”目录对于运行PHP服务器的任何用户都是可写的。如果您尝试执行此操作并且遇到相同的结果,则绝对要么分配了错误的权限,要么定位错误的目录。

请注意,对于配置为临时存储文件块的目录,您需要执行相同的操作。