Jump to content

[SOLVED] Uploading new files via form CHMODS to 600?


fri3ndly

Recommended Posts

I have a fully functional user upload form now which I am pleased about, however the uploaded files cannot be deleted as they are uploaded with permissions of '600'.

 

Is there any way in this script I can change it so that all uploaded files are automatically set to '755'?

 

<?php
	// If there is no such folder yet, create one
			 $upload_save_dir = $user_id;

                if(!file_exists($target_path)){ 

					mkdir($target_path);
					echo "A folder has been created for user '$FileUser'<br />";

				}

		/* Add the original filename to our target path.  
		Result is "uploads/filename.extension" */
		$target_path = $target_path . basename( $_FILES['FileName']['name']); 
		$_FILES['FileName']['tmp_name'];  


		if(move_uploaded_file($_FILES['FileName']['tmp_name'], $target_path)) {

			echo "The file ".  basename( $_FILES['FileName']['name']). " has been uploaded<br />";
		} else{
			echo "There was an error uploading the file, please try again!<br />";
		}
?>

Solved it....

 

	<?php	
if(move_uploaded_file($_FILES['FileName']['tmp_name'], $target_path)) {
			chmod($target_path, 0755);
			echo "The file ".  basename( $_FILES['FileName']['name']). " has been uploaded<br />";
		} else{
			echo "There was an error uploading the file, please try again!<br />";
		}?>

 

Thanks Nathan!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.