eleven0
eleven0

Reputation: 363

Laravel ErrorException (E_WARNING) fopen Upload does not work - ONLY FOR SOME FILES on S3

I just started (it wasn't happening before, upload was working fine) getting this error with my file uploads; I am currently on local development environment..

ErrorException (E_WARNING)
fopen(C:\Users\******\****\***): failed to open stream: Permission denied

My upload script;

$filepath = $attachment->storeAs("pdocs/customers", $formattedname);

The weird thing is that it only happens with some files. I am able to upload for instance some image files I have on my desktop. I am uploading it to my s3 account.

What am I missing here?

Upvotes: 1

Views: 1044

Answers (2)

eleven0
eleven0

Reputation: 363

After couple of tries, I noticed that I only had this issue with files bigger than 2MB. So change your local php.ini file;

post_max_size = 124M
upload_max_filesize = 64M

After doing this, problem was solved.

Upvotes: 0

Thiago Valente
Thiago Valente

Reputation: 703

This problem happen because you don't have permission to create the file in storage folder, you can try to test in your develop directory:

chmod -R 777 /storage

IMPORTANT: don't enable 777 in production server. You can read about how to enable storage here.

Upvotes: 1

Related Questions