NoteOnMe博客平台搭建
25개 이상의 토픽을 선택하실 수 없습니다. 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());
}
}
}