samedi 26 mars 2016

File upload system in laravel 5.1

I am trying to upload files using laravel5.1.But i am facing error like

FatalErrorException in Handler.php line 25: Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in E:\xampp\htdocs\mp-admin\vendor\compiled.php on line 1720 and defined in E:\xampp\htdocs\mp-admin\app\Exceptions\Handler.php:25 Stack trace: #0 E:\xampp\htdocs\mp-admin\vendor\compiled.php(1720): App\Exceptions\Handler->report(Object(Error)) #1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error)) #2 {main} thrown

Here is my view

<div class="form-group">
 <label >Logo</label>

 <input type="file"  name="image" >
</div>

Controller:

$entry = new companyprofiles();
$file = Input::get('image');
$extension = $file->getClientOriginalExtension();
Storage::disk('local')->put($file->getFilename().'.'.$extension,     File::get($file));

$entry->mime = $file->getClientMimeType();
$entry->original_filename = $file->getClientOriginalName();
$entry->filename = $file->getFilename().'.'.$extension;

$entry->save();

But first when i was trying it was storing in database and folder as well.after that continuously giving the same above error.

Please help me with this.if i do dd the value also its giving me the same error i could not able to find where is the error.Not getting stored in database.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire