Laravel不允许上传APK文件

时间:2017-02-25 08:05:57

标签: php laravel file-upload laravel-5.2

我在Laravel 5.2上写了一个用于上传文件的代码,但是当我想上传android APK文件时显示不允许和其他类型文件如pdf,...允许上传

代码:

     if($request->hasFile('file'))
     {
        if ($request->file('file')->isValid())
        {
            $file = $request->file('file');
            $destinationPath = storage_path('app');
            $fileName = time().'_'.rand(1111,9999).'_'.$file->getClientOriginalName();
            $file->move($destinationPath,$fileName);
            $uploadFile = $this->uploadFile->save_file($fileName,$destinationPath.'/'.$fileName,env('APP_URL').'/'.Request::segment(3).'/storage/app/'.$fileName);
            $this->activities->post(trans('uploader.upload_file'));
            return $this->respondCreated([
                'fileName' =>$uploadFile->filename,
                'url' => $uploadFile->hostFile
            ]);
        }
    }

0 个答案:

没有答案