user1012181
user1012181

Reputation: 8726

Setting upload path without the public folder

I'm trying to create a file upload in laravel.

When I try in localhost, the upload path should be something like:

public/upload/user. This works fine.

But when I upload it to the server, I'm getting an error like

permission denied mkdir()

So, I'l have to change the upload path to upload/user to ake it work.

Is there a fix for it? Let me know if you need additional information.

Upvotes: 0

Views: 121

Answers (1)

Ian Overton
Ian Overton

Reputation: 1060

I have encountered this before when the folder or file permissions itself didn't allow the apache user or apache group to edit that file. Please make sure that user has access to this folder. You can check the user name in the httpd.conf the default user is apache.

If you have Linux:

cd /<whateverTheFolderStructure>/public/upload/user
ls -ah

This should show the user and group that owns this folder and it should either say the user name or group that user is a member of or you'll need to make this folder changeable to anybody. I would recommend against this if at all possible, because it'll open it up to getting hacked.

you can use chmod 644 to give full access to the folder for the user chmod 664 to give access to the user and group and chmod 666 to give access to everybody.

If it's a file use 7 instead of 6 and 5 instead of 4.

Upvotes: 1

Related Questions