php:文件系统③

WBOY
Lepaskan: 2016-07-30 13:31:24
asal
913 orang telah melayarinya
span>html> html <span>lang=</span><span>"en"</span>> head> meta <span>charset=</span><span>"UTF-8"</span>> title><span>VIEW</span><span>title</span>> link <span>rel=</span><span>"stylesheet" </span><span>href=</span><span>"???" </span><span>type=</span><span>"text/css" </span>/> <span>head</span>> body> div <span>class=</span><span>"register"</span>> <span><!--</span><span宋体'">文件编码类型</span><span>enctype;---> </span><span></span>form <span>enctype=</span><span>"multipart/form-data" </span><span>method=</span><span>"post" </span><span>action=</span><span>"uploadprocess.php" </span><span>name=</span><span>"myform"</span>> table> tr>td <span>align=</span><span>"center" </span><span>colspan=</span><span>"2"</span>>font <span>style=</span><span>"</span><span><em>font-size</em></span>: <span>40</span><span>px</span>;<span><em>font-family</em></span>:<span>华文彩云</span>;<span>"</span>> <span>文件上传 </span><span></span><span>font</span>><span>td</span>><span>tr</span>> tr>td><span>请输入用户名:</span><span>td</span>>td>input <span>type=</span><span>"text" </span><span>name=</span><span>"username" </span>/> <span>td</span>><span>tr</span>> tr>td><span>请简单介绍该文件</span><span>td</span>>td>textarea <span>rows=</span><span>"10" </span><span>cols=</span><span>"40" </span><span>name=</span><span>"fileintro" </span>> <span>textarea</span>><span>td</span>><span>tr</span>> tr>td><span>请选择上传的文件:</span><span>td</span>>td>input <span>type=</span><span>"file" </span><span>name=</span><span>"myfile" </span>/> <span>td</span>><span>tr</span>> tr>td>input <span>type=</span><span>"submit" </span><span>value=</span><span>"</span><span>上传</span><span>"</span>><span>td</span>>td> <span>td</span>><span>tr</span>> <span>table</span>> <span>form</span>> <span>div</span>> <span>body</span>> <span>html</span>><precourier new font-size:16.5pt><img src="http://image.codes51.com/Article/image/20150816/20150816164640_4278.jpg" alt=""><precourier new font-size:16.5pt><precourier new font-size:16.5pt><span><?php </span>$username<span>=</span>$_POST[<span>'username'</span>]; $fileintro<span>=</span>$_POST[<span>'fileintro'</span>]; <span>echo </span>$username<span>.</span>$fileintro; <span>echo </span><span>"<pre class="brush:php;toolbar:false">"
Salin selepas log masuk
; print_r($_FILES); echo ""; //上传大文件时,需在php.ini中修改post_max_sizeupload_max_filesize参数; $user_path=$_SERVER['DOCUMENT_ROOT']."/Hanshunping/UP/".$username; $user_path=iconv("utf-8","gb2312",$user_path); if(!file_exists($user_path)){ mkdir($user_path); } $fileName=$_FILES['myfile']['name']; $fileName=iconv("utf-8","gb2312",$fileName); if(is_uploaded_file($_FILES['myfile']['tmp_name'])){ $uploaded_file=$_FILES['myfile']['tmp_name']; //避免同一用户上传的同一名字文件被覆盖; $move_to_file=$user_path."/".time().rand(1,1000). substr($fileName,strrpos($fileName,".")); if(move_uploaded_file($uploaded_file,$move_to_file)){ echo $_FILES['myfile']['name']."上传OK"; }else{ echo "上传失败"; } }else{ echo "FAILED"; }

以上就介绍了php:文件系统③,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan