Jump to content

Recommended Posts

So i have this simple upload script, grabs a file and shoots it over to a folder on the server.

The folders that the files get uploaded to have "Full Control" permission, but when the files get uploaded via this script, those permission do not carry over properly which give me a delete issue.

Can anyone give me some pointers how i could force the file to automatically inherit all permissions that it's containing folder holds.

 

script:

// Where the file is going to be placed 
	$target_dir = "Benefits/";

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

	if(move_uploaded_file($_FILES['thefile']['tmp_name'], $target_path)) 
		{
			echo "The file ".  basename( $_FILES['thefile']['name']). " has been uploaded to the Benefits/ folder.";
		}
	else
		{
			echo "There was an error uploading the file, please try again!";
		}

 

Thanks!

I think i should mention exactly what the permission issue is. I ran a script to check all file permissions.

substr(decoct(fileperms("Benefits/" . $file)),2);

And they all turn out 0666 no matter how they were uploaded.

However the ones that get uploaded via web form dont get "Everyone" in their securities tab, instead they get something called "Internet Guest Account"... but it need to get everyone i'm pretty sure in order to be allowed to delete the files.

... Sorry bloody modify wont work, some sesssion verification issues, let me add to that,

When uploaded through web form i get permissions as such

Admin

Internet Guest Account

Network Service

Power User

System

 

When uploaded normally via ftp, or directly into the folder on the server machine

Admin

Everyone

Pt. Jefferson HR

syxart

iPixel

 

Any idea why the file being uploaded gets totally different security groups and users?

Finally figured it out, all the folder permissions were set accurately except the c:windows/temp folder which was the temporary folder for uploaded files before they were moved to their final destination.

I simply changed the upload_tmp_dir in php ini to a folder that held the same permissions as i needed them to and voila! it works! Bloody windows :).

 

Thanks 2 all :).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.