0

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;
4
  • Most probably permission issue. Which OS you are using? Commented Sep 9, 2017 at 14:21
  • i am using macOS Sierra Commented Sep 9, 2017 at 14:23
  • Give 777 permission to your buletine folder and it should work. Commented Sep 9, 2017 at 14:24
  • how to give the 777 permission? Commented Sep 9, 2017 at 14:26

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

2 Comments

chmod 777 thumbs
@Andrei .. Okz fine ... Thumps Up if You get the ans :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.