NoteOnMe博客平台搭建
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
532 B

<?php
if(!empty($_FILES['file']['name'])){
//判断是否有文件
$fileinfo = $_FILES['file']; //将文件信息赋给变量$fileinfo
if($fileinfo['size']<1000000 && $fileinfo['size']>0){ //判断文件大小
try{if(move_uploaded_file($_FILES["file"]['tmp_name'],"image/".$fileinfo['name']))
{
$filepath="image/".$fileinfo['name'];
echo $filepath;
}}
catch (Exception $e) {
echo($e->getMessage());
}
}
}