无法在Digital Ocean服务器上创建“app / uploads / nameof文件夹/ 1578/3”目录Lravel4

时间:2016-01-21 06:28:04

标签: laravel-4 file-permissions digital-ocean

我的代码是抛出错误

无法创建“app / uploads / Rescom Summit Bangalore 2016/1578/3”目录

    if (Input::file($key)->isValid()) {
                          $destinationPath = 'app/uploads/'.$event.'/'.$userid.'/3'; // upload path
                          $extension = Input::file($key)->getClientOriginalExtension(); // getting image extension
                          $name = Input::file($key)->getClientOriginalName();
                          $curFilesize = Input::file($key)->getClientSize();
                          $mime =Input::file($key)->getMimeType();
                         // dd($mime);
                          //$fileName = $name; // renameing image
                          //$exstFileSize = Input::file($destinationPath, $fileName);
if (!File::exists($destinationPath."/boq-".$name)){ 
                            //creating details for saving inthe file_handler Table
                                $fileTblObj->user_id =  $userid;
                                $fileTblObj->eventName = $event ;
                                $fileTblObj->fileName = "boq-".$name;
                                $fileTblObj->formPage =3 ;
                                $fileTblObj->filePath = $destinationPath."/";
                                $fileTblObj->mime= $mime;
                                $ans->answer_text = 'Yes';


                                Input::file($key)->move($destinationPath, "boq-".$name); // uploading file to given path
                                //Input::file($key)->move($boqPath, $boqname); // uploading file to given path  
                                //Save filedetails
                                $fileTblObj->save();  
                                $ans->save();
                                Session::flash('success', 'Upload successfully'); 

                       }else if(File::size($destinationPath."/".$name) != $curFilesize){

                                $fileDtls = $fileTblObj->where('uid',$userid)->where('fileName',$name)->where('formPage',3)->first();
                                Input::file($key)->move($destinationPath, $name);
                                $ans->answer_text = 'Yes';
                                $ans->save(); 
                                $fileTblObj->where('id',$fileDtls->id)->update(array('updated_at'=>date("Y-m-d h:m:s",time())));
                        }
                      //return Redirect::to('upload');
                    }

同样在浏览器中我得到了

 protected function getTargetFile($directory, $name = null)
    {
        if (!is_dir($directory)) {
            if (false === @mkdir($directory, 0777, true)) {
                throw new FileException(sprintf('Unable to create the "%s" directory', $directory));
            }
        } elseif (!is_writable($directory)) {

这在我的本地系统上完全正常

我已更改权限

chmod -R 777 /var/www/laravel/app

任何人都可以帮助我解决这个问题

由于

0 个答案:

没有答案