asp.net_asp 无刷新上传带预览程序代码

更新时间:2019-10-13    来源:窗口特效    手机版     字体:

【www.bbyears.com--窗口特效】

首先我是使用艾恩ASP无组件上传类的iframe。直接在框架里面上传后赋值给父窗口的input。下面就是index.php的代码了。但是这个这能上传一张图片不能批量上传图片!
 
 单文件上传




<script>

function backfn(fname){

 document.getElementById("file").value=fname;

 document.getElementById("fimg").src="upload/"+fname;

}

</script>



 
 
然后这个是asp后台写入图片的代码了!是asp的注意
 

<%
if lcase(request.ServerVariables("REQUEST_METHOD"))="post" then
dim upload
set upload = new AnUpLoad
upload.Exe = "jpg|bmp|jpeg|gif|png"
upload.MaxSize = 2 * 1024 * 1024 '2M
upload.GetData()
if upload.ErrorID>0 then 
 response.Write upload.Description
else
 dim file,savpath
 savepath = "upload"
 set file = upload.files("file1")
 if file.isfile then
  result = file.saveToFile(savepath,0,true)
  if result then
   msg = file.filename
  else
   msg = file.Exception
  end if
 end if
end if
set upload = nothing
%>
重新上传
<script>window.parent.backfn.apply(this,["<%=msg%>"]);</script>
<%else%>
 
文件  

<%end if%>


 
至于 这个 UpLoad_Class.asp 文件大家就去网上找吧!。这个是就上传后的效果图片了
没有上传图片前

 

上传图片之后

 

本文来源:http://www.bbyears.com/wangyetexiao/72991.html

热门标签

更多>>

本类排行