服务端接收文件PHP代码

来源:互联网 发布:前锦网络信息技术公司 编辑:程序博客网 时间:2024/06/03 20:18
<?php
$dirname = 'down';
if(!is_dir($dirname)) {
    mkdir($dirname, 0777, true);
}
    $target_path  = "./down/";
    $target_path = $target_path.($_FILES['file']['name']);
    $target_path = iconv("UTF-8","gb2312", $target_path);
    if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {  
       echo "The file ".( $_FILES['file']['name'])." has been uploaded.";
    }else{  
       echo "There was an error uploading the file, please try again! Error Code: ".$_FILES['file']['error'];
    }

?>

0 0
原创粉丝点击