html xmlns ="http://www.w3.org/1999/xhtml" > head > meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" "> 跳转到主内容
websoft网络软件专家 - 深耕网络技术,打造实用软件!

php漫笔1-php图片处理

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>图片上传页title> <style type="text/css">.file-box{ position:relative;width:340px} .txt{ height:22px; border:1px solid #cdcdcd; width:200px;border-right:none;} .btn{ background-color:#FFF; border:1px solid #CDCDCD;height:26px; width:70px;} .file{ position:absolute; top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px } style> <script type="text/javascript" > //JS获取路径 ---成功 function change()
  {
var pic=document.getElementById('pic'); var file=document.getElementById('fileField'); pic.src=file.value; if(file.files){ if(file.files.item(0)){ //src = window.URL.createObjectURL(fileObj.files[0]); url=window.URL.createObjectURL(file.files.item(0)); document.getElementById('textfield').value = pic.src ; pic.src=url; } }  } script> head><body><form action="check_image.php" method="post" enctype="multipart/form-data"> <table border="1"> <tr> <td>上传人名称:td> <td><input type="text" class='txt' name="username" />td> tr> <tr> <td>*上传图片:td> <td><div class="file-box"><input type='text' name='textfield' id='textfield' class='txt' /><input type='button' class='btn' value='浏览...' /><br /> <input type="file" name="uploadfile" class="file" id="fileField" size="28" onchange="change();" /> <input type="hidden" id="theFilePath" name="theFilePath" value=""> div> td> tr> <tr> <td colspan="2"> <small><em> * 可接受的图像格式:GIF,JPG、JPEG和PNG。上传后图片会变为1280X960大小。em>small> td> tr> <tr> <td>图片标题:td> <td><input type="text" class='txt' name="caption"/>td> tr> <tr> <td colspan="2" style="text-align:center;"> <input type="submit" name="submit" value="Upload" class='btn' /> td> tr> table> <img src="" name="pic" id="pic" /> <br /> form>body>html>

相关文章