想知道上传图片代码怎么写吗,下面我就带大家一起详细分析一下吧。利用PHP,你总是可以有多种方式来完成某个特定的任务。我们就拿文件上传举个例子。当然了,你可以按照传统的方式来使用HTTP文件上传,把文件直接传输到Web服务器磁盘上。
PHP上传图片代码:
<ol class="dp-xml"> <li class="alt"><span><span class="tag"></span><span class="tag-name">phpsession_start</span><span>();</span><span class="tag">?></span><span> </span></span></li> <li class=""><span> </span></li> <li class="alt"> <span></span><span class="tag"></span><span class="tag-name">php</span><span> </span> </li> <li class=""> <span>$</span><span class="attribute">id</span><span>=</span><span class="attribute-value">mysql_connect</span><span>('localhost','root','585858'); </span> </li> <li class="alt"><span>mysql_select_db("okhwyy",$id); </span></li> <li class=""><span>mysql_query("setnamesgb2312"); </span></li> <li class="alt"> <span></span><span class="tag">?></span><span> </span> </li> <li class=""> <span></span><span class="tag"><span class="tag-name">html</span><span class="tag">></span><span> </span></span> </li> <li class="alt"> <span></span><span class="tag"><span class="tag-name">head</span><span class="tag">></span><span> </span></span> </li> <li class=""> <span></span><span class="tag"><span class="attribute">metahttp-equiv</span><span class="tag-name">metahttp-equiv</span><span>="Content-Type"</span><span class="attribute-value">c</span><span class="tag">></span><span> </span></span> </li> <li class="alt"> <span></span><span class="tag"><span class="tag-name">title</span><span class="tag">></span><span>限制上传图片的格式</span><span class="tag"></span><span class="tag-name">title</span><span class="tag">></span><span> </span></span> </li> <li class=""> <span></span><span class="tag"><span class="attribute">styletype</span><span class="tag-name">styletype</span><span>=</span><span class="attribute-value">"text/css"</span><span class="tag">></span><span> </span></span> </li> <li class="alt"><span></span></li> </ol>