I need to set permissions on files that I upload with the script below. I’m trying to implement chmod ($clean, 0600); but really don’t know where to add this as I’m getting the usual errors “No such file or directory” & “Unable to move” etc.
This works without chmod
Code: Select all
$source = $_FILES['fupload']['tmp_name'];
$target = "snail/attach/" .$_FILES['fupload']['name'];
/* Clean up spaces strip html tags white space make lowercase. */
$clean = strip_tags(trim(strtolower($target)));
//strip spaces
$clean = str_replace(' ' , '_' , $clean);
move_uploaded_file( $source, $clean ); // or die ("coultn't copy");
echo '<br><strong> File'. $clean . ' ' . 'was successfully Uploaded.</strong>';
}Code: Select all
move_uploaded_file( $source (chmod ($clean, 0600) ));Code: Select all
$clean = str_replace(' ' , '_' , $clean);
$setper=chmod ($clean, 0600);
move_uploaded_file( $source, $clean ); // or die ("coultn't copy");
echo '<br><strong> File'. $setper . ' ' . 'was successfully Uploaded.</strong>';