我在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
]);
}
}