asp.net - Change CHMOD of a file in PHP for specific user -
i have admin panel coded asp.net (c#). have textarea wordpress (redactor) , trying upload image it. using php file make upload after everytime upload image, encounter iis "401 - unauthorized: access denied due invalid credentials." error while displaying it. add 755 permission iis_iusr every timem after file upload. possible?
here php code:
$dir = 'assets/images/content/'; $_files['file']['type'] = strtolower($_files['file']['type']); if ($_files['file']['type'] == 'image/png' || $_files['file']['type'] == 'image/jpg' || $_files['file']['type'] == 'image/gif' || $_files['file']['type'] == 'image/jpeg' || $_files['file']['type'] == 'image/pjpeg') { // setting file's mysterious name $filename = md5(date('ymdhis')).'.jpg'; $file = $dir.$filename; // copying move_uploaded_file($_files['file']['tmp_name'], $file); chmod($file, 0777); // displaying file $array = array( 'filelink' => 'assets/images/content/'.$filename ); echo stripslashes(json_encode($array)); }
try this: computer management (right click on computer , select manage) --> local users , groups --> users --> select iusr_machinename (ie,iusr_tomato-clownfis) --> right click properties --> make sure member of iis_wpg , users , not guests.
Comments
Post a Comment