" Filesystem.php第435行中的ErrorException:mkdir():权限被拒绝" Goddady live hosting

时间:2017-03-27 10:56:43

标签: php laravel-5.3

我正在研究laravel项目我通过存储方法创建了一个控制器我已将表单数据插入数据库并将项目图片存储到 / home / domain / public / images / projects / 1st project / imgName 但它给了我以下错误。你们能帮助我吗? 还有一件事在本地Xampp服务器上正常工作

Godday主办的当前PHP版本5.6

> ErrorException in Filesystem.php line 435:
mkdir(): Permission denied
in Filesystem.php line 435
at HandleExceptions->handleError(2, 'mkdir(): Permission denied', '/home/vertexmarketing/public_html/beta/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', 435, array('path' => '/images/projects/1st project/', 'mode' => 511, 'recursive' => true, 'force' => false))
at mkdir('/images/projects/1st project/', 511, true) in Filesystem.php line 435
at Filesystem->makeDirectory('/images/projects/1st project/', 511, true) in Facade.php line 221
at Facade::__callStatic('makeDirectory', array('/images/projects/1st project/', 511, true)) in ProjectController.php line 89
at File::makeDirectory('/images/projects/1st project/', 511, true) in ProjectController.php line 89
at ProjectController->store(object(Request))
at call_user_func_array(array(object(ProjectController), 'store'), array(object(Request))) in Controller.php line 55
at Controller->callAction('store', array(object(Request))) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(ProjectController), 'store') in Route.php line 204
at Route->runController() in Route.php line 160
at Route->run() in Router.php line 559
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Router.php line 561
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 520
at Router->dispatchToRoute(object(Request)) in Router.php line 498
at Router->dispatch(object(Request)) in Kernel.php line 174
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ValidatePostSize.php line 27
at ValidatePostSize->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54

控制器:

public function store(Request $request)
{

//validate the data
$this->validate($request, [
'name' => 'required|max:50',
'type' => 'required|max:50',
'contract' => 'required|max:50',
'city' => 'required|max:50',
'location' => 'required|max:250',
'bathrooms' => 'required|max:50',
'bedrooms' => 'required|max:50',
'garages' => 'required|max:50',            
'area' => 'required|max:50',
'price' => 'required|max:50',
'installmentplan' => 'required|max:50'


]);

//Store into the database 

$project = new projects;

$project->name = $request->name;
$project->description = $request->description;
$project->type = $request->type;
$project->contract = $request->contract;
$project->city = $request->city;
$project->location = $request->location;
$project->bathrooms = $request->bathrooms;
$project->bedrooms = $request->bedrooms;
$project->garages = $request->garages;
$project->area = $request->area;
$project->price = $request->price;
$project->installmentplan = $request->installmentplan;

if ($request->hasfile('image')) {
# code...
$image = $request->file('image');
$filename = time() .'.'. $image->getClientOriginalName();
$path = '/images/projects/' . $project->name . '/';
if(!File::exists($path)) {
// path does not exist
File::makeDirectory($path, 0777, true);
}

$location = public_path() . $path . $filename; 

Image::make($image)->resize(640, 425)->save($location);

$project->image = $path . $filename;
}


$project->save();

//redirect to the view
//return redirect()->route('project.show', $project->id);
return redirect()->route('project.index');



}

0 个答案:

没有答案