Jump to content
xisto Community
Sign in to follow this  
Dennis56

Setting Permissions With Php File Uploader

Recommended Posts

How can i allow for people to upload images from my site to another path?

When i made the script i get this error

Warning: move_uploaded_file(uploads/38120806topic_split.gif): failed to open stream: Permission denied in /home/ninjach/public_html/upload.php on line 26
Warning: move_uploaded_file(): Unable to move '/tmp/phpQyLuQt' to 'uploads/38120806topic_split.gif' in /home/ninjach/public_html/upload.php on line 26


Share this post


Link to post
Share on other sites
if(!isset($_POST['upload'])) {echo '<form name="upload" enctype="multipart/form-data" method="POST" action="'.$_SERVER['REQUEST_URI'].'"><input type="file" name="file" size="13" value=""><br /><input type="submit" name="upload" value="Upload"></form>';} else {if(($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") ||($_FILES["file"]["type"] == "image/png") ||($_FILES["file"]["type"] == "image/jpg")){$uploaddir = 'uploads/';$filename = $_FILES['file']['name'];$filesize = $_FILES['file']['size'];$tmpname_file = $_FILES['file']['tmp_name'];	$date_file = date(imdy);move_uploaded_file($tmpname_file, "$uploaddir$date_file$filename");//Connection MySQL//Select DB//update MySQL}else{echo"Invalid file type.";}  }

Share this post


Link to post
Share on other sites

In your cpanel, chmod the permissions on the temporary directory and the uploads directory to 777.

Share this post


Link to post
Share on other sites

You can do two ways:1) access your cPanel, click on the folder (not the folder icon) you're trying to change mode, right hand menu "change permission." This is done through File Manager.2) using your FTP software, right click on the folder and select the permission or chmod menu. This is different from which FTP software you're using.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.