![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
Upload Permissions
I am currently working on a project which requires the upload of files to a specific directory. It seems the only way to upload the file is to chmod the directory to 777. My question is what is the danger associated with doing that, surely having a directory that the whole world can write to is bad right? And if this approach is bad then what other ways exists to upload the files.
__________________
Quote:
|
|
|
|
|
|
|
#2 |
|
Expert Programmer
|
Re: Upload Permissions
A common approach is to use a directory with permissions set to 777 below your web root directory (eg, if your web root is /public_html/, you might use /uploads/).
|
|
|
|
|
|
#3 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
Re: Upload Permissions
How can apache serve the files then, I thought it was only allowed to serve anything within or below the document root?
__________________
Quote:
|
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: Upload Permissions
You shouldn't have needed to do that. Make sure the username you are using is the privileged owner of the directory, when you're FTPing the files over.
I'm assuming you mean 'above'. And yes, but it's also circumstantial upon how your service has configured Apache. |
|
|
|
|
|
#5 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
Re: Upload Permissions
I am not using an FTP client Sane. I am uploading them using a HTML Form
__________________
Quote:
|
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: Upload Permissions
Oh, and you've written a PHP uploader to handle the upload and save it to the current directory? Maybe you should focus on the root of the problem here: the uploader.
Is the owner of the .php script the same as the owner of the directory? I'm not exactly sure how it works, but I assume if the .php script is not the owner of the directory, then it can't write to the directory (unless it's 777). |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| winsock troubles w/ upload file | c0ldshadow | C++ | 2 | Feb 3rd, 2006 9:00 PM |
| Upload Picture | yip_kw_trowa | PHP | 3 | Oct 14th, 2005 8:36 AM |
| Upload file without using <INPUT TYPE="FILE"> | bennyz12 | HTML / XHTML / CSS | 8 | Aug 31st, 2005 3:59 PM |
| Upload a file by getting the file form drive | bennyz12 | ASP | 1 | Jul 29th, 2005 8:46 PM |
| Help with the file upload control | Lipo | HTML / XHTML / CSS | 3 | May 2nd, 2005 11:32 AM |