Beispiel #1
0
 /**
  * Store a newly created File in storage.
  *
  * @param CreateFileRequest $request
  *
  * @return Response
  */
 public function store(CreateFileRequest $request)
 {
     $input = $request->all();
     $file = $this->fileRepository->create($input);
     Flash::success('File saved successfully.');
     return redirect(route('files.index'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateFileRequest $request)
 {
     $title = $request->get('title');
     $description = $request->get('description');
     $path = $this->storeFile($request);
     $instance = File::create(['title' => $title, 'description' => $description, 'path' => $path]);
     return response()->json(['data' => "The file {$instance->name} was created with id {$instance->id}"], 200);
 }
Beispiel #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param $folder
  * @param CreateFileRequestRequest|CreateFileRequest|Request $request
  * @return Response
  */
 public function store($folder, CreateFileRequest $request)
 {
     $allowedTypes = ['txt', 'pdf', 'docx', 'jpg', 'png', 'ppt', 'doc', 'jpeg', 'jpe'];
     $type = $request->file('file')->getClientOriginalExtension();
     $name = $request->name;
     if ($request->file('file')->getClientSize() > 10000000) {
         return redirect()->back()->with('error', 'The file must be under 10Mb in size.');
     }
     if (!$this->repo->authenticateType($type, $allowedTypes)) {
         return redirect()->back()->with('error', 'This file extension is not supported.');
     }
     $this->repo->uploadGroupDocument($_FILES, 'documents', $folder, $type, $name);
     $this->flash('The File has now been successfully uploaded');
     return redirect()->back();
 }