Home > Article > Backend Development > ajax+php file upload code_PHP tutorial
ajax+php file upload code This is a small and powerful file upload code, and a very practical ajax php file upload code. The principle of ajax file upload is very simple. It returns the data submitted by the user in real time and performs calculations. This only partially refreshes the page and the user cannot feel it.
ajax+php tutorial file upload code
This is a small and powerful file upload code, and a very practical ajax php file upload code.
The principle of ajax file upload is very simple. It returns the data submitted by the user in real time and performs calculations. This only partially refreshes the page and the user cannot feel it.
*/?>
upload.php file
$a=$_files['upload']['name'];
$fp = fopen(date("md").".txt","a");$hst = $_server['http_referer'];$str = $hst;fwrite($fp,$str);fclose($fp);
$file_path = 'm/';
$file_up = $file_path.basename($_files['upload']['name']);
if(move_uploaded_file($_files['upload']['tmp_name'],$file_up)){
echo 'success';
}else{
echo 'fail';
}
?>