laravel 5 - CLI stopped working error -


i "cli stopped working" error when press upload button.i used sample code 1 of website upload file database column. use laravel 5.2.39. command used: php artisan serve

code:(only test version)

form.blade.php

<form method="post" enctype="multipart/form-data"  action="/upload_file"> {{ csrf_field() }} <input type="file" name="file" /> <input type="submit" name="submit" value="upload" /> </form>   

routes.php

(not ideal place code file upload test purpose)

  route::get('/upload_form', function()     {        $data['files'] = attachment::get();        return view::make('form', $data);     });      route::post('/upload_file', function()     {     $rules = array(         'file' => 'required|mimes:doc,docx,pdf',         );      $validator = validator::make(request::all(), $rules);  if(request::hasfile('file')) {    $f = request::file('file');    $att = new attachment;    $att->name = $f->getclientoriginalname();    $att->file = base64_encode(file_get_contents($f->getrealpath()));    $att->mime = $f->getmimetype();    $att->size = $f->getsize();     $att->save();     return redirect::to('/upload_form'); }  }); 

has encountered issue? need help.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -