回 帖 发 新 帖 刷新版面

主题:[求助]图片上传问题

在第一页中有一个文本框和一个按钮,点按钮弹出一个窗口,然后上传图片,上传成功后把上传的图片值自动写到第一页的文本框中,可是我这个现在不能实现。希望大家帮我看一下。还有就是传以后的图片不能在文件夹中。
代码:
<!--#include file="upload.inc"-->
<%
dim upload,file,formName,formPath,iCount,filename,fileExt
set upload=new upload_5xSoft ''建立上传对象
 formPath=upload.form("FileName")
 ''在目录后加(/)
 if right(formPath,1)<>"/" then formPath=formPath&"/" 
iCount=0
for each formName in upload.file ''列出所有上传了的文件
 set file=upload.file(formName)  ''生成一个文件对象
 if file.filesize<100 then
     response.write "请选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]"
    response.end
 end if
 if file.filesize>100*1000 then
     response.write "文件大小超过了限制100K [ <a href=# onclick=history.go(-1)>重新上传</a> ]"
    response.end
 end if
 fileExt=lcase(right(file.filename,4))
 uploadsuc=false
Forum_upload="gif,jpg,png"
 Forumupload=split(Forum_upload,",")
 for i=0 to ubound(Forumupload)
    if fileEXT="."&trim(Forumupload(i)) then
    uploadsuc=true
    exit for
    else
    uploadsuc=false
    end if
 next
 if uploadsuc=false then
     response.write "文件格式不正确 [ <a href=# onclick=history.go(-1)>重新上传</a> ]"
    response.end
 end if
 randomize
 strJS="<SCRIPT language=javascript>" & vbcrlf
 ranNum=int(90000*rnd)+10000
 filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&fileExt

 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  file.SaveAs Server.mappath(FileName)   ''保存文件
    for i=0 to ubound(Forumupload)
        if fileEXT="."&trim(Forumupload(i)) then
        exit for
        end if
    next
 iCount=iCount+1
 end if
 set file=nothing
next
set upload=nothing  ''删除此对象
Htmend iCount&" 个文件上传结束!"
sub HtmEnd(Msg)
 set upload=nothing
end sub
end if
%>
这是弹出窗口的页面
<form action="admin_imgok.asp" method="post" enctype="multipart/form-data" name="form1">
      <table width="400" height="71"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#006699">
        <tr bgcolor="#D4D0C8">
          <td width="18%" height="39" bgcolor="#006699"><div align="right" class="STYLE1">选择 : </div></td>
          <td width="82%" bgcolor="#006699"><div align="left">
          <input type="hidden" name="filepath" value="uploadimg">
            <input name="FileName" type="file" id="FileName" size="30" maxlength="100" />
          </div></td>
        </tr>
        <tr bgcolor="#D4D0C8">
          <td height="2" colspan="2" bgcolor="#006699"><hr align="center" width="92%" size="1" noshade /></td>
        </tr>
        <tr bgcolor="#D4D0C8">
          <td bgcolor="#006699">&nbsp;</td>
          <td height="30" bgcolor="#006699"><input type="submit" name="Submit3" value="上  传"  />
                <input type="button" name="Submit32" value="取  消" onclick="window.close();"/></td>
        </tr>
      </table>
    </form>

回复列表 (共2个回复)

沙发

在1页用open打开一个页,在open页写个上传代码利用openr把返回值写入 1页
这个思路清晰了吧.

板凳

清楚,但不会写啊

我来回复

您尚未登录,请登录后再回复。点此登录或注册