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

3 years ago
  1. <?php
  2. if(!empty($_FILES['file']['name'])){
  3. //判断是否有文件
  4. $fileinfo = $_FILES['file']; //将文件信息赋给变量$fileinfo
  5. if($fileinfo['size']<1000000 && $fileinfo['size']>0){ //判断文件大小
  6. try{if(move_uploaded_file($_FILES["file"]['tmp_name'],"image/".$fileinfo['name']))
  7. {
  8. $filepath="image/".$fileinfo['name'];
  9. echo $filepath;
  10. }}
  11. catch (Exception $e) {
  12. echo($e->getMessage());
  13. }
  14. }
  15. }