温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

简单的php文件上传系统

发布时间:2020-06-09 20:28:59 来源:网络 阅读:263 作者:gutaotao1989 栏目:web开发
<?php
if (isset ($_GET['type'])&& $_GET['type']=="send"){
    if ($_FILES['userfile']['error']==0) {
          /*echo 'File Name: '.$_FILES['userfile']['name'].'<br>';
          echo 'File Type: '.$_FILES['userfile']['type'].'<br>';
          echo 'File Size: '.$_FILES['userfile']['size'].'<br>';
          echo 'Temporary Name: '.$_FILES['userfile']['tmp_name'].'<br>';*/
          $tmpFile= $_FILES['userfile']['tmp_name'];
          $newFile=getcwd().'/'.$_FILES['userfile']['name'];
          if (move_uploaded_file($tmpFile, $newFile))
                   echo '
                   <p ><strong>Your file is uploaded successfully.</strong></p>
                    ';
          else
                   echo '
                   <p ><strong>An error occurred while uploading.</strong></p>
                    ';
    }else
          echo 'An Error occuerd NO.: '.$_FILES['userfile']['error'].'<br>';
}
?>
<html><body>
    <div  >
<form enctype= "multipart/form-data" action= "<?php echo $_SERVER['PHP_SELF'].'?type=send' ?>" method= "POST" >
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
        <span >
    <strong><span >Upload Your File:
</span><br>
</strong></span><br ><span ><strong>File: </strong>
        </span> <input name="userfile" type="file"  /> <br>
        <br >
    <input type="submit" value="Send"  />
    <br><font face="Tahoma"><a target="_blank" href="http://www.pinlan.com/"><span >PHP Free Code</span></a></font>
   
</form></div>
</body></html>


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI