Delete file created with php script from php -
i have script creates, updates or delete file given argument on /var/www/ folder.
if( $_server['request_method'] === 'put' ){ $params = json_decode(file_get_contents("php://input")); $myfile = fopen( '/var/www/folder/'. $params->name , "w") or die('failed open file'. $params['name']); fwrite( $myfile, $params->command ); fclose(); } else if( $_server['request_method'] === 'delete' ){ $params = json_decode(file_get_contents("php://input")); echo unlink( '/var/www/folder/'. $params->name )? "the file deleted" : "the file not deleted". '\n'; }
i having issue, though. files being succesfully created in folder, aren't being deleted unlink command - returns false.
the apache server running on ubuntu machine. 'folder' permissions 777 , permissions script.
files created inside folder of user:group www-data. permissions default permissions.
any ideas on why script can't delete files has created itself?
Comments
Post a Comment