Andrei
Andrei

Reputation: 79

Image upload error in Laravel

I am trying to upload a image to database but it's giving me the:Can't write image data to path (/Applications/XAMPP/xamppfiles/htdocs/agrohelp/public/uploads/buletine/1504966392.jpeg)" error

here is the code:

$buletin=$request->file('buletin');
$filename = time().'.'.$buletin->getClientOriginalExtension();
Image::make($buletin)->resize(300,300)->save(public_path('/uploads/buletine/'.$filename)); 

$employee->buletin=$filename;

Upvotes: 0

Views: 820

Answers (1)

And Try Like This:

Check The Permissions: - permission images/articles 777

Image::make($image->getRealPath())->resize(300,300)->save('public/uploads/bulentine'.$filename);

Give The Permissions Like This:

Use CHMOD

For Your Recursive file

chmod -R 777 foldername or pathname

For Non Recursive file

chmod 777 foldername or pathname

Upvotes: 1

Related Questions