文件管理 · 2022年9月16日

asp文件上传|怎么修改asp文件上传大小限制

Ⅰ asp怎样上传文件

ASP有无组件上传,使用比较多。网上有相关实例和介绍

Ⅱ asp收信空间和FTP上传具体步骤

申请个免费的空间要求支持asp的把asp文件上传(FTP上传具体继续看下面)到空间的访问目录一般为www或者wwwroot== FTP上传你可以直接用浏览器在网址上输入你申请的免费空间的访问的地址(免费给你的2级或者3级域名)输入的格式为ftp;//xxx.xxx.xxx.com然后输入用户名和密码就可以上去了 像复制粘贴电脑文件一样的把asp文件粘贴上去

Ⅲ 上传ASP怎么上传啊

既然是上传,那么一定是有服务器或空间(如果是自己的服务器,那么现在服务器里面创建站点),那么就应该有空间的ftp地址、账号及密码,使用上传工具(举例:flashfxp、cuteftp等),录入ftp信息后,打开服务器空间,界面一般分左右两边,左边是本机,右边是服务器(也可以自己设置),一般服务器里面会有个wwwroot的文件夹,从左边找到本机要上传的asp文件,把根目录的程序上传到wwwroot文件夹下即可。

Ⅳ 如何上传ASP文件

如何打开asp文件?可以用frontpage,记事本也可以。如果你下载的文件是asp文件,而且又很小的话(几kb),说明没下载成功!!!!!!!!因为asp文件你是下载不了的。是动态网页文件需要网页制作软件打开,例如:FrontpageDreamweaver也可以用记事本打开进行编辑,然后另存为.html文件浏览静态内容ASP是ActiveServerPage的缩写,意为“活动服务器网页”。ASP是微软公司开发的代替CGI脚本程序的一种应用,它可以与数据库和其它程序进行交互,是一种简单、方便的编程工具。ASP的网页文件的格式是.asp,现在常用于各种动态网站中。ASP是一种服务器端脚本编写环境,可以用来创建和运行动态网页或web应用程序。ASP网页可以包含HTML标记、普通文本、脚本命令以及COM组件等。利用ASP可以向网页中添加交互式内容(如在线表单),也可以创建使用HTML网页作为用户界面的web应用程序。与HTML相比,ASP网页具有以下特点:(1)利用ASP可以实现突破静态网页的一些功能限制,实现动态网页技术;(2)ASP文件是包含在HTML代码所组成的文件中的,易于修改和测试;(3)服务器上的ASP解释程序会在服务器端制定ASP程序,并将结果以HTML格式传送到客户端浏览器上,因此使用各种浏览器都可以正常浏览ASP所产生的网页;(4)ASP提供了一些内置对象,使用这些对象可以使服务器端脚本功能更强。例如可以从web浏览器中获取用户通过HTML表单提交的信息,并在脚本中对这些信息进行处理,然后向web浏览器发送信息;(5)ASP可以使用服务器端ActiveX组建来执行各种各样的任务,例如存取数据库、发现哦那个Email或访问文件系统等。(6)由于服务器是将ASP程序执行的结果以HTML格式传回客户端浏览器,因此使用者不会看到ASP所编写的原始程序代码,可放置ASP程序代码被窃取。

Ⅳ asp 上传文件问题

http://www.aspprogram.cn/soft.asp?id=59试试这个代码

Ⅵ asp 提交表单和上传文件

asp.net和asp上传方式基本相似。都需要使用到form表单。下面分别介绍asp和asp.net两种文件上传方式。

第一种:asp方式

首先建立form表单

<form name="form1" method="post" action="send.asp"enctype="multipart/form-data">

<input name="title" type="text"/>

<input name="uploadimg" type="file" />

<input name="submit" type="submit" value="提交"/>

</form>

asp的表单一定要注意加上enctype="multipart/form-data"这个属性,否则是上传不了图片的,这个属性很关键。

上传处理代码也就是send.asp的处理代码。

因为asp本身没有上传的组件或控件,这里只能借助第三方式的组件或类。上传组件推荐使用aspJpeg组件,这个组件不仅可以上传文件,如果是图片的话,可以调节尺寸尺寸,创建缩略图等。很方便,目前一般的空间商都支持这个组件,另外就是使用组件上传类,像风声,无惧等,都是无组件上传。

上传代码,这里假设采用的是风声无组件上传类。类文件已经包含进去。

<include file="uploadclass.asp"–>

处理代码:

先初始化上传类

dim myrequest

set myrequest = new UpLoadClass

设置属性:

myrequest.FileType="gif,jpeg,jpg,png" //设置上传类型

myrequest.SavePath="../upload/" //设置上传路径

myrequest.MaxSize=100*1024 //设置上传文件的大小,

myrequest.AutoSave=1 //设置保存方式,为1表示自动保存

myrequest.Open //打开文件流

title =myrequest.form("title")

img =myrequest.form("uploadimg") //这两部表示接收form表单中的数据。不 能再用request.form或request.querystring来接收了,必须用刚才初始化的对象

myrequest来接收。

现在数据接收到了,剩下的就是保存到数据库。这和常用的数据保存方式一下的,拼接SQL.然后再执行,这里不赘述。

第二种asp.net方式。

asp.net方式,因为采用的是服务器控件,所以与asp有点区别。

首先是form不同,asp.net的form是服务器控件,需要添加ID和runat="Server"如

<form name="form1" ID="form1" runat="Server">

<asp:FileUpload ID="FileUpload1"runat="server" /><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="上传" />

</form>

处理代码,上传并保存代码

protectedvoidButton1_Click(objectsender, EventArgs e) {StringsavePath = Server.MapPath("upload");if(FileUpload1.HasFile) {Stringfilename; filename = FileUpload1.FileName; savePath +=filename; FileUpload1.SaveAs(savePath);Page.Response.Write(FileUpload1.PostedFile.ContentType + FileUpload1.PostedFile.ContentLength+"<br>");Page.Response.Write("<img src='"+savePath+"'>");

}else {Page.Response.Write("fff"); } }

asp提交和上传文件,与asp.net是不同的。一个是html标签,一个是服务器控件。相对来说,asp.net的文件上传比asp简单很多,因为asp.net提供了相对应的上传控件。而asp没有。只有采用第三方组件或无组件上传类。上传文件成功后,另外还可以加入更多的处理元素,如图片入库,加上水印等,这需要你自己去思考和查找资料了。

Ⅶ 【急】asp如何文件上传

下面是用ASP写的,已经测试过 文件上传有个非常重要的地方,就是限制格式,严格规定只有什么格式才可以上传否则可能会被黑客利用这些光用DW自动生成是做不出来的 要自己写代码<%if Request.QueryString("submit")="swf_Pic" thenuploadpath=""uploadsize="1024"uploadtype="jpg/gif/png/bmp"Set Uprequest=new UpLoadClass Uprequest.SavePath=uploadpath Uprequest.MaxSize=uploadsize*1024 Uprequest.FileType=uploadtype AutoSave=true Uprequest.open if Uprequest.form("file_Err")<>0 then select case Uprequest.form("file_Err") case 1:str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件超过"&uploadsize&"k [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>" case 2:str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件格式不对 [<a href='javascript:history.go(-1)']>重新上传</a>]</font></div>" case 3:str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件太大且格式不对 [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>" end select response.write str else response.write "<script language=""javascript"">parent.form.swf_Pic.value='"&Uprequest.SavePath&Uprequest.Form("file")&"';" response.write "</script>" response.write "<div style=""padding-top:5px;padding-bottom:5px;""> <font color=red>文件上传成功</font> [<a href='javascript:history.go(-1)'>重新上传</a>]</div>" end ifSet Uprequest=nothingend ifresponse.write "<form name=form action=?action=swf_Pic&submit=swf_Pic method=post enctype=multipart/form-data>"response.write "<input type=file name=file class='tx' size='20'> "response.write "<input type=submit name=submit value=上传 class=""tx1"">"response.write "</form>"'============================================================上传函数Class UpLoadClass Private p_MaxSize,p_FileType,p_SavePath,p_AutoSave,p_Error Private objForm,binForm,binItem,strDate,lngTime Public FormItem,FileItem Public Property Get Version Version="Rumor UpLoadClass Version 2.0" End Property Public Property Get Error Error=p_Error End Property Public Property Get MaxSize MaxSize=p_MaxSize End Property Public Property Let MaxSize(lngSize) if isNumeric(lngSize) then p_MaxSize=clng(lngSize) end if End Property Public Property Get FileType FileType=p_FileType End Property Public Property Let FileType(strType) p_FileType=strType End Property Public Property Get SavePath SavePath=p_SavePath End Property Public Property Let SavePath(strPath) p_SavePath=replace(strPath,chr(0),"") End Property Public Property Get AutoSave AutoSave=p_AutoSave End Property Public Property Let AutoSave(byVal Flag) select case Flag case 0: case 1: case 2: case false:Flag=2 case else:Flag=0 end select p_AutoSave=Flag End Property Private Sub Class_Initialize p_Error = -1 p_MaxSize = 153600 p_FileType = "jpg/gif" p_SavePath = "" p_AutoSave = 0 strDate = replace(cstr(Date()),"-","") lngTime = clng(timer()*1000) Set binForm = Server.CreateObject("ADODB.Stream") Set binItem = Server.CreateObject("ADODB.Stream") Set objForm = Server.CreateObject("Scripting.Dictionary") objForm.CompareMode = 1 End Sub Private Sub Class_Terminate objForm.RemoveAll Set objForm = nothing Set binItem = nothing binForm.Close() Set binForm = nothing End Sub Public Sub Open() if p_Error=-1 then p_Error=0 else Exit Sub end if Dim lngRequestSize,binRequestData,strFormItem,strFileItem Const strSplit="'"">" lngRequestSize=Request.TotalBytes if lngRequestSize<1 then p_Error=4 Exit Sub end if binRequestData=Request.BinaryRead(lngRequestSize) binForm.Type = 1 binForm.Open binForm.Write binRequestData Dim bCrLf,strSeparator,intSeparator bCrLf=ChrB(13)&ChrB(10) intSeparator=InstrB(1,binRequestData,bCrLf)-1 strSeparator=LeftB(binRequestData,intSeparator) Dim p_start,p_end,strItem,strInam,intTemp,strTemp Dim strFtyp,strFnam,strFext,lngFsiz p_start=intSeparator+2 Do p_end =InStrB(p_start,binRequestData,bCrLf&bCrLf)+3 binItem.Type=1 binItem.Open binForm.Position=p_start binForm.CopyTo binItem,p_end-p_start binItem.Position=0 binItem.Type=2 binItem.Charset="gb2312" strItem=binItem.ReadText binItem.Close() p_start=p_end p_end =InStrB(p_start,binRequestData,strSeparator)-1 binItem.Type=1 binItem.Open binForm.Position=p_start lngFsiz=p_end-p_start-2 binForm.CopyTo binItem,lngFsiz intTemp=Instr(39,strItem,"""") strInam=Mid(strItem,39,intTemp-39) if Instr(intTemp,strItem,"filename=""")<>0 then if not objForm.Exists(strInam&"_From") then strFileItem=strFileItem&strSplit&strInam if binItem.Size<>0 then intTemp=intTemp+13 strFtyp=Mid(strItem,Instr(intTemp,strItem,"Content-Type: ")+14) strTemp=Mid(strItem,intTemp,Instr(intTemp,strItem,"""")-intTemp) intTemp=InstrRev(strTemp,"\") strFnam=Mid(strTemp,intTemp+1) objForm.Add strInam&"_Type",strFtyp objForm.Add strInam&"_Name",strFnam objForm.Add strInam&"_Path",Left(strTemp,intTemp) objForm.Add strInam&"_Size",lngFsiz if Instr(intTemp,strTemp,".")<>0 then strFext=Mid(strTemp,InstrRev(strTemp,".")+1) else strFext="" end if if left(strFtyp,6)="image/" then binItem.Position=0 binItem.Type=1 strTemp=binItem.read(10) if strcomp(strTemp,chrb(255) & chrb(216) & chrb(255) & chrb(224) & chrb(0) & chrb(16) & chrb(74) & chrb(70) & chrb(73) & chrb(70),0)=0 then if Lcase(strFext)<>"jpg" then strFext="jpg" binItem.Position=3 do while not binItem.EOS do intTemp = ascb(binItem.Read(1)) loop while intTemp = 255 and not binItem.EOS if intTemp < 192 or intTemp > 195 then binItem.read(Bin2Val(binItem.Read(2))-2) else Exit do end if do intTemp = ascb(binItem.Read(1)) loop while intTemp < 255 and not binItem.EOS loop binItem.Read(3) objForm.Add strInam&"_Height",Bin2Val(binItem.Read(2)) objForm.Add strInam&"_Width",Bin2Val(binItem.Read(2)) elseif strcomp(leftB(strTemp,8),chrb(137) & chrb(80) & chrb(78) & chrb(71) & chrb(13) & chrb(10) & chrb(26) & chrb(10),0)=0 then if Lcase(strFext)<>"png" then strFext="png" binItem.Position=18 objForm.Add strInam&"_Width",Bin2Val(binItem.Read(2)) binItem.Read(2) objForm.Add strInam&"_Height",Bin2Val(binItem.Read(2)) elseif strcomp(leftB(strTemp,6),chrb(71) & chrb(73) & chrb(70) & chrb(56) & chrb(57) & chrb(97),0)=0 or strcomp(leftB(strTemp,6),chrb(71) & chrb(73) & chrb(70) & chrb(56) & chrb(55) & chrb(97),0)=0 then if Lcase(strFext)<>"gif" then strFext="gif" binItem.Position=6 objForm.Add strInam&"_Width",BinVal2(binItem.Read(2)) objForm.Add strInam&"_Height",BinVal2(binItem.Read(2)) elseif strcomp(leftB(strTemp,2),chrb(66) & chrb(77),0)=0 then if Lcase(strFext)<>"bmp" then strFext="bmp" binItem.Position=18 objForm.Add strInam&"_Width",BinVal2(binItem.Read(4)) objForm.Add strInam&"_Height",BinVal2(binItem.Read(4)) end if end if objForm.Add strInam&"_Ext",strFext objForm.Add strInam&"_From",p_start intTemp=GetFerr(lngFsiz,strFext) if p_AutoSave<>2 then objForm.Add strInam&"_Err",intTemp if intTemp=0 then if p_AutoSave=0 then strFnam=GetTimeStr() if strFext<>"" then strFnam=strFnam&"."&strFext end if binItem.SaveToFile Server.MapPath(p_SavePath&strFnam),2 objForm.Add strInam,strFnam end if end if else objForm.Add strInam&"_Err",-1 end if end if else binItem.Position=0 binItem.Type=2 binItem.Charset="gb2312" strTemp=binItem.ReadText if objForm.Exists(strInam) then objForm(strInam) = objForm(strInam)&","&strTemp else strFormItem=strFormItem&strSplit&strInam objForm.Add strInam,strTemp end if end if binItem.Close() p_start = p_end+intSeparator+2 loop Until p_start+3>lngRequestSize FormItem=split(strFormItem,strSplit) FileItem=split(strFileItem,strSplit) End Sub Private Function GetTimeStr() lngTime=lngTime+1 GetTimeStr=strDate&lngTime End Function Private Function GetFerr(lngFsiz,strFext) dim intFerr intFerr=0 if lngFsiz>p_MaxSize and p_MaxSize>0 then if p_Error=0 or p_Error=2 then p_Error=p_Error+1 intFerr=intFerr+1 end if if Instr(1,LCase("/"&p_FileType&"/"),LCase("/"&strFext&"/"))=0 and p_FileType<>"" then if p_Error<2 then p_Error=p_Error+2 intFerr=intFerr+2 end if GetFerr=intFerr End Function Public Function Save(Item,strFnam) Save=false if objForm.Exists(Item&"_From") then dim intFerr,strFext strFext=objForm(Item&"_Ext") intFerr=GetFerr(objForm(Item&"_Size"),strFext) if objForm.Exists(Item&"_Err") then if intFerr=0 then objForm(Item&"_Err")=0 end if else objForm.Add Item&"_Err",intFerr end if if intFerr<>0 then Exit Function if VarType(strFnam)=2 then select case strFnam case 0:strFnam=GetTimeStr() if strFext<>"" then strFnam=strFnam&"."&strFext case 1:strFnam=objForm(Item&"_Name") end select end if binItem.Type = 1 binItem.Open binForm.Position = objForm(Item&"_From") binForm.CopyTo binItem,objForm(Item&"_Size") binItem.SaveToFile Server.MapPath(p_SavePath&strFnam),2 binItem.Close() if objForm.Exists(Item) then objForm(Item)=strFnam else objForm.Add Item,strFnam end if Save=true end if End Function Public Function GetData(Item) GetData="" if objForm.Exists(Item&"_From") then if GetFerr(objForm(Item&"_Size"),objForm(Item&"_Ext"))<>0 then Exit Function binForm.Position = objForm(Item&"_From") GetData=binFormStream.Read(objForm(Item&"_Size")) end if End Function Public Function Form(Item) if objForm.Exists(Item) then Form=objForm(Item) else Form="" end if End Function Private Function BinVal2(bin) dim lngValue,i lngValue = 0 for i = lenb(bin) to 1 step -1 lngValue = lngValue *256 + ascb(midb(bin,i,1)) next BinVal2=lngValue End Function Private Function Bin2Val(bin) dim lngValue,i lngValue = 0 for i = 1 to lenb(bin) lngValue = lngValue *256 + ascb(midb(bin,i,1)) next Bin2Val=lngValue End FunctionEnd Class%>

Ⅷ 怎么修改asp文件上传大小限制

你好方法如下:asp上传大小限制iis中默认为200K,下面是修改asp上传大小限制详细专步骤 1、以记事本属方式打开c:\windows\system32\inetsrv\metabase.xml 2、把其中AspMaxRequestEntityAllowed="20480000"即添加两个0(把ASP上传文件大小限制从200K改为20M)。编辑好保存完最好重启下iis服务! 3、重启iis方法:开始–运行–输入cmd回车–输入iisreset岂可重启iis 或者你也可以进开始–管理工具–服务–最下面有个World Wide Web Publishing Service的服务重启即可 注意:如果metabase.xml修改后想保存但是提示无法编辑,不能保存!这是由于你没有在iis中启用“允许直接编辑配置数据库”的功能。希望能帮到你。

Ⅸ 如何使用AspUpload组件上传文件

你好,试试以下的方法:一、摘要Asp组件有内置的、服务器安装时附带的,更多的是第三方提供的,今天来学习文件上传的其中一个组件aspupload组件使用方法。二、aspupload组件的下载、安装或注册 1、asp组件的下载、安装(1)可以从网上下载。 (2)直接双击后进行安装。AspUpload组件下载2、asp上传组件的功能 a.限制上载文件的大小 b.设置用户的权限 c.修改文件属性 d.同时上载多个文件 e.能够将文件保存到数据库中 f.支持文件删除,自动生成与服务器上文件不同名的文件 g.拥有管理权限的用户甚至可以使用该控件进行远程注册三、aspupload组件的简单应用1、实例一(1.asp):通过代码实现三个文件的上传功能。如下图所示: (1)静态页面:1个表单,三个文件域,一个按钮,其中表单form的动作如下。 (2)其中客户端文件要注意几点: * 文件上载提交表单(Form)的enctype必须指定为“multipart/form-data”* 语句表示上载文件域,用户可以在该域中输入或选定文件。 * 传递一个参数act(名称可自己取),其值可以自己随便定,目的是触发上传事件。(3)动态代码如下: 2、实例二(2.asp):修改程序1.asp,要求在上传文件后显示上传文件的文件名及大小。增加如下代码: response.write("文件1是:")response.write(upload.files(1).path)response.write("文件2是:")response.write(upload.files(2).path)response.write("文件3是:")response.write(upload.files(3).path) 说明:upload.files方法用来获取文件的相关属性,path是文件的路径,size是文件的大小。3、实例三(3.asp):修改程序2.asp,要求上传的三个文件大小不能超过5K,如果上传的文件已经存在则要求不覆盖文件。 在上传之前增加如下代码: upload.setmaxsize 5120,falseupload.overwritefiles=fals说明: (1)upload.setmaxsize 5120,false其功能为设置文件最大为5120字节,false参数说明当文件超过5120字节时则删除超过部分,true参数说明当文件超过5120字节时则出错。 (2)upload.overwritefiles=false,其功能表示文件不进行覆盖,如果上传同样文件名的文件,上传后文件名自动会在后面添加一个数字。四、自学第二个上传文件的组件 1、Lyfupload组件的下载 2、学习此组件的安装或注册 3、通过课本例子进行文件的上传五、问题 1、传到学校里服务器172.18.0.7运行时出现以下错误,Server.CreateObject 失败分析原因:学校服务器不支持aspupload上传组件 2、如果服务器不支持aspupload等上传组件,请大家使用无组件上传功能(编写代码),见书本上P322,此类代码比较复杂,同学们能够拿来使用,无须自己编写。3、大家在网上申请个人空间时要看清服务器支持哪些组件,这样有利于编写代码。