aijava

welcome to my online log ! open java new world! Taste java charm........
posts - 1, comments - 4, trackbacks - 0, articles - 42
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

php 上传图片

Posted on 2007-02-08 17:37 阅读(220) 评论(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;
?>

只有注册用户登录后才能发表评论。


网站导航:
 
http://freehost13.websamba.com