asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx

上传人:b****8 文档编号:22858898 上传时间:2023-02-05 格式:DOCX 页数:16 大小:18.48KB
下载 相关 举报
asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx_第1页
第1页 / 共16页
asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx_第2页
第2页 / 共16页
asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx_第3页
第3页 / 共16页
asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx_第4页
第4页 / 共16页
asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx

《asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx》由会员分享,可在线阅读,更多相关《asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx(16页珍藏版)》请在冰豆网上搜索。

asp怎样上传文件到指定的文件夹并在access中记录路径Word下载.docx

注意:

是上传文件,不是图片。

文件包括exe、rar、zip、doc、jpg等等。

最佳答案上传文件页index.asp开始-index.asp代码如下functiona(htmlurl)varwin=window.open(htmlurl,newwin,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=300,height=10,left=380,top=380);

汽车照片:

inputtype=textname=qczpclass=zc_inputmaxlength=100value=readonly上传文件页index.asp结束-uploadprod.asp选择图片上传开始-uploadprod.asp代码如下上传图片functioncheck()varmf=document.up;

if(mf.image.value.length4)alert(请选择需要上传的图片.);

mf.image.focus();

returnfalse;

returntrue;

if(window.Event)document.captureEvents(Event.MOUSEUP);

functionnocontextmenu()event.cancelBubble=trueevent.returnValue=false;

functionnorightclick(e)if(window.Event)if(e.which=2|e.which=3)returnfalse;

elseif(event.button=2|event.button=3)event.cancelBubble=trueevent.returnValue=false;

document.oncontextmenu=nocontextmenu;

/forIE5+document.onmousedown=norightclick;

/forallothers上传图片选择图片:

上传文件页uploadprod.asp结束-判断文件以及文件是否存在则上传uploadprod2.asp开始-uploadprod2.asp源代码图片上传if(window.Event)document.captureEvents(Event.MOUSEUP);

/forallothers%AllowFileExtStr=jpg,gif,png,bmpdimIDdimupload,path,file1,filename1setupload=newupload_5xSoft建立上传对象图片上传formPath=./Carpic/上传图片目录开始上传图片setfile1=upload.file(image)filename1=year(now()&

-&

month(now()&

day(now()&

_&

hour(now()&

Minute(now()&

Second(now()&

right(file1.FileName,4)iffile1.FileSize0then如果FileSize0说明有文件数据FileExtName=mid(file1.FileName,InStrRev(file1.FileName,.)+1)ifCheckFileType(AllowFileExtStr,FileExtName)=Falsethenresponse.Writefile1.FileName&

文件:

不允许上传!

上传文件类型有:

&

AllowFileExtStr&

response.Writeresponse.Write你的IP:

Replace(Request.ServerVariables(REMOTE_ADDR),)&

response.Writeresponse.write你的操作已被系统所记录!

response.End()endiffile1.SaveAsServer.mappath(formPath&

filename1)保存文件上传图片成功path1=/Carpic/&

filename1elseresponse.write请选择要插入的图片文件endifsession(qczp)=path1%图片上传成功.alert(图片上传成功!

);

opener.document.zc.qczp.value=;

window.close();

%判断文件以及文件是否存在则上传uploadprod2.asp结束-另外需要一个上传组件文件为zupload.asp开始-代码如下dimData_5xsoftClassupload_5xsoftdimobjForm,objFile,VersionPublicfunctionForm(strForm)strForm=lcase(strForm)ifnotobjForm.exists(strForm)thenForm=elseForm=objForm(strForm)endifendfunctionPublicfunctionFile(strFile)strFile=lcase(strFile)ifnotobjFile.exists(strFile)thensetFile=newFileInfoelsesetFile=objFile(strFile)endifendfunctionPrivateSubClass_InitializedimRequestData,sStart,vbCrlf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,theFiledimiFileSize,sFilePath,sFileType,sFormValue,sFileNamedimiFindStart,iFindEnddimiFormStart,iFormEnd,sFormNameVersion=上传程序Version2.0setobjForm=Server.CreateObject(Scripting.Dictionary)setobjFile=Server.CreateObject(Scripting.Dictionary)ifRequest.TotalBytes1thenExitSubsettStream=Server.CreateObject(adodb.stream)setData_5xsoft=Server.CreateObject(adodb.stream)Data_5xsoft.Type=1Data_5xsoft.Mode=3Data_5xsoft.OpenData_5xsoft.WriteRequest.BinaryRead(Request.TotalBytes)Data_5xsoft.Position=0RequestData=Data_5xsoft.ReadiFormStart=1iFormEnd=LenB(RequestData)vbCrlf=chrB(13)&

chrB(10)sStart=MidB(RequestData,1,InStrB(iFormStart,RequestData,vbCrlf)-1)iStart=LenB(sStart)iFormStart=iFormStart+iStart+1while(iFormStart+10)0thensettheFile=newFileInfo取得文件名iFindStart=InStr(iFindEnd,sInfo,filename=,1)+10iFindEnd=InStr(iFindStart,sInfo,1)sFileName=Mid(sinfo,iFindStart,iFindEnd-iFindStart)theFile.FileName=getFileName(sFileName)theFile.FilePath=getFilePath(sFileName)取得文件类型iFindStart=InStr(iFindEnd,sInfo,Content-Type:

1)+14iFindEnd=InStr(iFindStart,sInfo,vbCr)theFile.FileType=Mid(sinfo,iFindStart,iFindEnd-iFindStart)theFile.FileStart=iInfoEndtheFile.FileSize=iFormStart-iInfoEnd-3theFile.FormName=sFormNameifnotobjFile.Exists(sFormName)thenobjFile.addsFormName,theFileendifelse如果是表单项目tStream.Type=1tStream.Mode=3tStream.OpenData_5xsoft.Position=iInfoEndData_5xsoft.CopyTotStream,iFormStart-iInfoEnd-3tStream.Position=0tStream.Type=2tStream.Charset=gb2312sFormValue=tStream.ReadTexttStream.CloseifobjForm.Exists(sFormName)thenobjForm(sFormName)=objForm(sFormName)&

&

sFormValueelseobjForm.AddsFormName,sFormValueendifendifiFormStart=iFormStart+iStart+1wendRequestData=settStream=nothingEndSubPrivateSubClass_TerminateifRequest.TotalBytes0thenobjForm.RemoveAllobjFile.RemoveAllsetobjForm=nothingsetobjFile=nothingData_5xsoft.ClosesetData_5xsoft=nothingendifEndSubPrivatefunctionGetFilePath(FullPath)IfFullPathThenGetFilePath=left(FullPath,InStrRev(FullPath,)ElseGetFilePath=EndIfEndfunctionPrivatefunctionGetFileName(FullPath)IfFullPathThenGetFileName=mid(FullPath,InStrRev(FullPath,)+1)ElseGetFileName=EndIfEndfunctionEndClassClassFileInfodimFormName,FileName,FilePath,FileSize,FileType,FileStartPrivateSubClass_InitializeFileName=FilePath=FileSize=0FileStart=0FormName=FileType=EndSubPublicfunctionSaveAs(FullPath)dimdr,ErrorChar,iSaveAs=trueiftrim(fullpath)=orFileStart=0orFileName=orright(fullpath,1)=/thenexitfunctionsetdr=CreateObject(Adodb.Stream)dr.Mode=3dr.Type=1dr.OpenData_5xsoft.position=FileStartData_5xsoft.copytodr,FileSizedr.SaveToFileFullPath,2dr.Closesetdr=nothingSaveAs=falseendfunctionEndClass另外需要一个上传组件文件为zupload.asp结束-另需要建立一个文件夹来存放文件我是用的formPath=./Carpic/上传图片目录也就是说本程序的上面一个文件夹为Carpic

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 自我管理与提升

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1