文件上传以后怎样记录上传的文件地址的啊?

来源:百度知道 编辑:UC知道 时间:2024/06/28 13:18:00
如:
<td><iframe name="I1" frameborder=0 width="100%" height=30 scrolling=no src="upload.asp"></iframe><input type="text" name="content_up_file" id="content_up_file" size="20" maxlength="80" value="????"></td>

像上面这样我把文件上传以后要样可以使得地址传送到表格输入框的:value值!

其中upload.asp代码为:
<form name="form1" method="post" action="saveupload.asp" enctype="multipart/form-data">
<tr>
<td align="left">
<input type="file" name="file1" size=10 class="an">
<input type="submit" name="Submit" value="上传" class="an"> </td>
</tr>
</form>

saveupload.asp :

<body bgcolor="<%=bgcolor%>" leftmargin="0" topmargin="0">

file.filename 就是上传文件的原来文件名。
还有你应该在Response.Write"文件类型非法" 后面加上response.end
不然文件还还是被上传了。

</script>
<%
set upload=new upload_5xSoft
set file=upload.file("file1"
formPath="upload/"
if file.filesize>100 then
fileExt=lcase(right(file.filename,3))
if fileExt="asp" then
Response.Write"文件类型非法"
end if
end if
randomize
ranNum=int(990000*rnd)+910000
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
if file.FileSize>0 then
file.SaveAs Server.mappath(FileName)