多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 简单的文件上传 > 我也不知道写啥,毕竟还没有深入的了解和学习就简单暴力一下,cvcode吧 ## 代码 filesupload.html: ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form action="./fileupload.php" method="post" enctype="multipart/form-data"> 选择文件 <input name="file" type="file"> <input type="submit"> </form> </body> </html> ~~~ filesupload.php: ~~~ <?php define('ROOT',dirname(__FILE__).'/'); if ($_FILES['file']['error']) { echo $_FILES['file']['error']; } else { echo $_FILES['file']['name'].'<br/>'; echo $_FILES['file']['type'].'<br/>'; echo $_FILES['file']['size'].'<br/>'; echo $_FILES['file']['tmp_name'].'<br/>'; if (file_exists('uplooad/'.$_FILES['file']['name'])) { echo '文件已经存在'.$_FILES['file']['name'].'<br/>'; } else { $stor_path = ROOT.'/upload/'.basename($_FILES['file']['name']); move_uploaded_file($_FILES['file']['tmp_name'], $stor_path); echo "文件存储在: " . "upload/" . $_FILES["file"]["name"]; } } ~~~