![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Hobbyist Programmer
|
Changing File/Folder Permission
Hello Everyone, I was wondering if anyone knew how to change the file or Folder Permission in PHP. I have one script that for some weird reason has to have the destination Folder be set so that everyone can write to this, this is not ideal for a web file. I'm trying to make a folder with the date (where I'm getting stopped because permissions is denied. And then as you can see I want to put 3 files in there. I know it works if I change the folder to 777 but I don't want it to be. I was thinking about way could be ftp with php but that to me will take to much time to set up though I've done it before. This is also running on a mac server. Here is the code I'm working with if you want to see (not really important):
[php] $location = "/home/username/public_html/files/"; if (file_exists($location . $month . "-" . $day . "-" . $year)){ echo "Date Already Present. If you would like to write over this, delete the previous one and then add the new one"; } else { mkdir($location . $month . "-" . $day . "-" . $year . "/",0755); if ($wmaupload == "1"){ //copy temp file to the folder if (is_uploaded_file($_FILES['wma']['tmp_name'])){ move_uploaded_file($_FILES['wma']['tmp_name'],$location . $month . "-" . $day . "-" . $year . "/" . $_FILES['wma']['name']) or $wmaerror = true; if ($wmaerror){ $error .= "The Windows Media File could not be Copied"; } } else { $error .= "The Windows Media File could not be uploaded"; $wmaerror = true; }/**/ echo "wma = 1"; } if ($mp3upload == "1"){ //copy temp file to the folder if (is_uploaded_file($_FILES['mp3']['tmp_name'])){ move_uploaded_file($_FILES['mp3']['tmp_name'],$location . $month . "-" . $day . "-" . $year . "/" . $_FILES['mp3']['name']) or $mp3error = true; if ($mp3error){ $error .= "The MP3 File could not be Copied"; } } else { $error .= "The MP3 File could not be uploaded"; $mp3error = true; }/**/ echo "mp3 = 1"; } if ($pdfupload == "1"){ //copy temp file to folder if (is_uploaded_file($_FILES['pdf']['tmp_name'])){ move_uploaded_file($_FILES['pdf']['tmp_name'],$location . $month . "-" . $day . "-" . $year . "/" . $_FILES['pdf']['name']) or $pdferror = true; if ($pdferror){ $error .= "The PDF File could not be Copied"; } } else { $error .= "The PDF File could not be uploaded"; $pdferror = true; }/**/ echo "pdf = 1"; } } [/php] |
|
|
|
| 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 |
| Permission error | Samuaijack | ASP.NET | 4 | Nov 1st, 2006 6:21 PM |
| Changing The <title> Tags | Sane | JavaScript and Client-Side Browser Scripting | 2 | Jul 16th, 2006 12:44 PM |
| changing permissions in windows XP using ruby!! | kraf001 | Other Programming Languages | 0 | Sep 27th, 2005 2:58 AM |
| ADSI Changing Password - Access Denied | bobfox | Visual Basic .NET | 1 | Sep 22nd, 2005 2:22 PM |
| Permission denied | soren | HTML / XHTML / CSS | 1 | Jan 18th, 2005 7:42 AM |