Posted on 2007-02-08 17:37
苑 阅读(218)
评论(0) 编辑 收藏 所属分类:
PHP 学习
upload.php 文件代码
<form enctype="multipart/form-data" action="readimg.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
readimg.php 文件代码
<?php
if(is_array($HTTP_POST_FILES)){
$upfile = $HTTP_POST_FILES[userfile][tmp_name];
$upfile_name = $HTTP_POST_FILES[userfile][name];
}
$path_translated = "upload/"; //上传文件夹
$UpLoadPath = addslashes(dirname($path_translated))."/upload/";
$FileName = $UpLoadPath."$upfile_name"; //$upfile_name就是上传的文件名
$file_name = $up_load_path."$upfile_name";
echo $upfile;
echo $file_name;
if($upfile!="none" && $upfile!="" && $upfile_name!=""){
copy($upfile,$FileName);
}
echo $file_name;
?>