前台代码:

<html>
<head>
    <title>上传文件</title>
</head>
<body>
    <form enctype="multipart/form-data" action="upload.php" method="post">
        <input type="file" name="uploadfile" />
        <input type="submit" value="上传"/>
    </form>
</body>
</html>

 

后台代码:

<?php 
    
    //上传单文件
    require 'HTTP/Upload.php';
   
    $upload = new HTTP_Upload();
    
    $file = $upload->getFiles('uploadfile');
    
    if ($file->isValid()) {
        $file->moveTo('uploads/');
        echo 'OK!';
    }else {
        echo 'False!';
    }
    
?>

 


最终:
PHP - 使用pear的HTTP_Upload包进行上传

PHP - 使用pear的HTTP_Upload包进行上传

PHP - 使用pear的HTTP_Upload包进行上传

相关文章:

  • 2021-12-08
  • 2021-12-07
  • 2022-12-23
  • 2021-07-08
  • 2022-01-16
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-12-31
  • 2021-08-02
  • 2021-06-19
相关资源
相似解决方案