asp关于图片上传生成的路径问题!!!
我现在有一段上传图片的代码,但是写到数据库里面的图片路径是图片的名字+生成时间,好像是这样的:picname[uploading]fengyuan_07062210052...
我现在有一段上传图片的代码,但是写到数据库里面的图片路径是图片的名字+生成时间,好像是这样的:picname[uploading]fengyuan_070622100521.jpg[/uploading]
我现在想让生成的路径是这样的:pic/fengyuan_070622100521.jpg
应该怎么改下面的代码呢????
或者有一套新的完整的代码...非常感激,愿意追加!!
<%
set upload=new upload_5xSoft
formPath="upload/"
set file=upload.file("file1")
if file.FileSize=0 then
response.write "错误:请选择要上传的图片! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
filename = split(file.FileName,".")
filehz = filename(ubound(filename))
if filehz<>"jpg" and filehz<>"jpeg" and filehz<>"gif" then
response.write "错误:上传的文件格式不对! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
fengyuan="fengyuan_"&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&"."&filename(ubound(filename))
file.SaveAs Server.mappath(formPath&fengyuan)
%>
<script>
parent.form1.content.value+='[uploadimg]<%=fengyuan%>[/uploadimg]'
</script> 展开
我现在想让生成的路径是这样的:pic/fengyuan_070622100521.jpg
应该怎么改下面的代码呢????
或者有一套新的完整的代码...非常感激,愿意追加!!
<%
set upload=new upload_5xSoft
formPath="upload/"
set file=upload.file("file1")
if file.FileSize=0 then
response.write "错误:请选择要上传的图片! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
filename = split(file.FileName,".")
filehz = filename(ubound(filename))
if filehz<>"jpg" and filehz<>"jpeg" and filehz<>"gif" then
response.write "错误:上传的文件格式不对! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
fengyuan="fengyuan_"&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&"."&filename(ubound(filename))
file.SaveAs Server.mappath(formPath&fengyuan)
%>
<script>
parent.form1.content.value+='[uploadimg]<%=fengyuan%>[/uploadimg]'
</script> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询