快捷搜索:   nginx

任意文件上传代码(最终修改版)

上传页:

<form enctype="multipart/form-data" name="upImage_form" action="chuli.php" method="post">
   <table>
       <tr>
     <td>文件上传:
         <input name="upfile" type="file" style="width:200;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="17">
                        <input name="Submit" type="submit" value="上传" style="width:30;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="17"><br><br><br>
     </td>
      </tr>
   </table>
</form>

处理页:

<?php
if($_POST['Submit']=='上传'){
$fname = $_FILES["upfile"]["name"];
$dest_folder = "picture/";
$uploadfile = $dest_folder.$fname;

if(move_uploaded_file($_FILES["upfile"]["tmp_name"],$uploadfile)){
   echo "文件上传成功!";
}else{
   echo "文件上传失败!";
}
}

echo "<a href=".$url.$uploadfile.">"."点击下载"."</a>";

?>


顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论