<?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());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|