ASP.Classic: File uploading...

ASP.Classic: File uploading...

am 08.04.2008 19:14:37 von Blue Streak

Hi, folks!

I have scoured the Internet high and low trying to look trying to
find a simple example of uploading a file to a server using
ASP.Classic. After a lot of searching I think I have it distilled
down to its simplest form illustrated in my example. But, alas, it
doesn't work :/ Upon further investigation it turns out my example
coughs up 0 for Response.TotalBytes causing an error condition.

So, what am I missing?

TIA...

Client side (application.asp):


-
-




Server side (submission.asp):
<%
szFileName = "test.bin"
Set adStream = Server.CreateObject("ADODB.Stream")
adStream.Type = 1 'adTypeBinary
adStream.Open
adStream.Write(Response.BinaryRead(Response.TotalBytes))
adStream.SaveToFile(szFileName)
adStream.Close
%>

Re: ASP.Classic: File uploading...

am 08.04.2008 19:16:35 von Blue Streak

On Apr 8, 1:14=A0pm, Blue Streak wrote:
> Hi, folks!
>
> =A0 =A0 I have scoured the Internet high and low trying to look trying to
> find a simple example of uploading a file to a server using
> ASP.Classic. =A0After a lot of searching I think I have it distilled
> down to its simplest form illustrated in my example. =A0But, alas, it
> doesn't work :/ =A0Upon further investigation it turns out my example
> coughs up 0 for Response.TotalBytes causing an error condition.
>
> So, what am I missing?
>
> TIA...
>
> Client side (application.asp):
>


> -
> -
>
>
>

>
> Server side (submission.asp):
> <%
> szFileName =3D "test.bin"
> Set adStream =3D Server.CreateObject("ADODB.Stream")
> adStream.Type =3D 1 'adTypeBinary
> adStream.Open
> adStream.Write(Response.BinaryRead(Response.TotalBytes))
> adStream.SaveToFile(szFileName)
> adStream.Close
> %>

I am testing these under WinXP:SP2 with IIS 5.1

Re: ASP.Classic: File uploading...

am 08.04.2008 20:01:16 von reb01501

Blue Streak wrote:
> Hi, folks!
>
> I have scoured the Internet high and low trying to look trying to
> find a simple example of uploading a file to a server using
> ASP.Classic. After a lot of searching I think I have it distilled
> down to its simplest form illustrated in my example. But, alas, it
> doesn't work :/ Upon further investigation it turns out my example
> coughs up 0 for Response.TotalBytes causing an error condition.
>
> So, what am I missing?
>
> TIA...
>
> Client side (application.asp):
>


> -
> -
>
>
>

>

You missed the part where you tell the server that your submission is a
multipart/form-data submission.

enctype='multipart/form-data'>




See here for more information:
http://classicasp.aspfaq.com/forms/how-do-i-upload-files-fro m-the-client-to-the-server.html

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: ASP.Classic: File uploading...

am 08.04.2008 20:18:09 von Blue Streak

On Apr 8, 2:01=A0pm, "Bob Barrows [MVP]"
wrote:
> Blue Streak wrote:
> > Hi, folks!
>
> > =A0 =A0 I have scoured the Internet high and low trying to look trying t=
o
> > find a simple example of uploading a file to a server using
> > ASP.Classic. =A0After a lot of searching I think I have it distilled
> > down to its simplest form illustrated in my example. =A0But, alas, it
> > doesn't work :/ =A0Upon further investigation it turns out my example
> > coughs up 0 for Response.TotalBytes causing an error condition.
>
> > So, what am I missing?
>
> > TIA...
>
> > Client side (application.asp):
> >


> > -
> > -
> >
> >
> >

>
> You missed the part where you tell the server that your submission is a
> multipart/form-data submission.
>
>
> enctype=3D'multipart/form-data'>
> =A0 =A0
> =A0 =A0 > '>
>

>
> See here for more information:http://classicasp.aspfaq.com/forms/how-do-i-=
upload-files-from-the-cli...
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.- Hide quoted text -
>
> - Show quoted text -

D'oh!

Thanks.

Re: ASP.Classic: File uploading...

am 08.04.2008 20:19:43 von paulrichardbaker

And shouldn't that be Request.TotalBytes?

You will get poor performance that could impact the whole server with large
files, because ASP is buffering the request in memory and then you're coping
it into memory as well. Here is a newsgroup post that discusses that.

Large file upload/download using IIS:
http://groups.google.com/group/microsoft.public.inetserver.i is/browse_thread/thread/e99f6592b55af061

Paul

"Bob Barrows [MVP]" wrote in message
news:%23lh2LKamIHA.4140@TK2MSFTNGP04.phx.gbl...
> Blue Streak wrote:
>> Hi, folks!
>>
>> I have scoured the Internet high and low trying to look trying to
>> find a simple example of uploading a file to a server using
>> ASP.Classic. After a lot of searching I think I have it distilled
>> down to its simplest form illustrated in my example. But, alas, it
>> doesn't work :/ Upon further investigation it turns out my example
>> coughs up 0 for Response.TotalBytes causing an error condition.
>>
>> So, what am I missing?
>>
>> TIA...
>>
>> Client side (application.asp):
>>


>> -
>> -
>>
>>
>>

>>
>
> You missed the part where you tell the server that your submission is a
> multipart/form-data submission.
>
>
> enctype='multipart/form-data'>
>
>
>

>
> See here for more information:
> http://classicasp.aspfaq.com/forms/how-do-i-upload-files-fro m-the-client-to-the-server.html
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

Re: ASP.Classic: File uploading...

am 08.04.2008 20:29:40 von Blue Streak

On Apr 8, 2:19=A0pm, "Paul Baker [MVP, Windows Desktop Experience]"
wrote:
> And shouldn't that be Request.TotalBytes?
>
> You will get poor performance that could impact the whole server with larg=
e
> files, because ASP is buffering the request in memory and then you're copi=
ng
> it into memory as well. Here is a newsgroup post that discusses that.
>
> Large file upload/download using IIS:http://groups.google.com/group/micros=
oft.public.inetserver.iis/browse...
>
> Paul
>
> "Bob Barrows [MVP]" wrote in messagenews:%23lh2=
LKamIHA.4140@TK2MSFTNGP04.phx.gbl...
>
>
>
> > Blue Streak wrote:
> >> Hi, folks!
>
> >> =A0 =A0 I have scoured the Internet high and low trying to look trying =
to
> >> find a simple example of uploading a file to a server using
> >> ASP.Classic. =A0After a lot of searching I think I have it distilled
> >> down to its simplest form illustrated in my example. =A0But, alas, it
> >> doesn't work :/ =A0Upon further investigation it turns out my example
> >> coughs up 0 for Response.TotalBytes causing an error condition.
>
> >> So, what am I missing?
>
> >> TIA...
>
> >> Client side (application.asp):
> >>


> >> -
> >> -
> >>
> >>
> >>

>
> > You missed the part where you tell the server that your submission is a
> > multipart/form-data submission.
>
> >
> > enctype=3D'multipart/form-data'>
> > =A0 =A0
> > =A0 =A0> '>
> >

>
> > See here for more information:
> >http://classicasp.aspfaq.com/forms/how-do-i-upload-files-fr om-the-cli...
>
> > --
> > Microsoft MVP -- ASP/ASP.NET
> > Please reply to the newsgroup. The email account listed in my From
> > header is my spam trap, so I don't check it very often. You will get a
> > quicker response by posting to the newsgroup.- Hide quoted text -
>
> - Show quoted text -

Oh, yeah... D'oh!

Re: ASP.Classic: File uploading...

am 08.04.2008 20:34:18 von reb01501

Paul Baker [MVP, Windows Desktop Experience] wrote:
> And shouldn't that be Request.TotalBytes?
>
> You will get poor performance

I can't argue with that. It's discussed in the article I linked to.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

RE: ASP.Classic: File uploading...

am 08.04.2008 21:32:00 von BDJJ

If at all possible do it with a simple .NET page (called from your Classic
ASP page) - it's simple, clean, and fast - Classic ASP, I found, is terrible
for file uploads. Looks like everyone answered your OP so I won't add my 2
cents worth.

"Blue Streak" wrote:

> Hi, folks!
>
> I have scoured the Internet high and low trying to look trying to
> find a simple example of uploading a file to a server using
> ASP.Classic. After a lot of searching I think I have it distilled
> down to its simplest form illustrated in my example. But, alas, it
> doesn't work :/ Upon further investigation it turns out my example
> coughs up 0 for Response.TotalBytes causing an error condition.
>
> So, what am I missing?
>
> TIA...
>
> Client side (application.asp):
>


> -
> -
>
>
>

>
> Server side (submission.asp):
> <%
> szFileName = "test.bin"
> Set adStream = Server.CreateObject("ADODB.Stream")
> adStream.Type = 1 'adTypeBinary
> adStream.Open
> adStream.Write(Response.BinaryRead(Response.TotalBytes))
> adStream.SaveToFile(szFileName)
> adStream.Close
> %>
>

Re: ASP.Classic: File uploading...

am 08.04.2008 22:23:23 von Blue Streak

On Apr 8, 3:32=A0pm, B@DJJ wrote:
> If at all possible do it with a simple .NET page (called from your Classic=

> ASP page) - it's simple, clean, and fast - Classic ASP, I found, is terrib=
le
> for file uploads. =A0Looks like everyone answered your OP so I won't add m=
y 2
> cents worth.
>
>
>
> "Blue Streak" wrote:
> > Hi, folks!
>
> > =A0 =A0 I have scoured the Internet high and low trying to look trying t=
o
> > find a simple example of uploading a file to a server using
> > ASP.Classic. =A0After a lot of searching I think I have it distilled
> > down to its simplest form illustrated in my example. =A0But, alas, it
> > doesn't work :/ =A0Upon further investigation it turns out my example
> > coughs up 0 for Response.TotalBytes causing an error condition.
>
> > So, what am I missing?
>
> > TIA...
>
> > Client side (application.asp):
> >


> > -
> > -
> >
> >
> >

>
> > Server side (submission.asp):
> > <%
> > szFileName =3D "test.bin"
> > Set adStream =3D Server.CreateObject("ADODB.Stream")
> > adStream.Type =3D 1 'adTypeBinary
> > adStream.Open
> > adStream.Write(Response.BinaryRead(Response.TotalBytes))
> > adStream.SaveToFile(szFileName)
> > adStream.Close
> > %>- Hide quoted text -
>
> - Show quoted text -

That may be true but this host doesn't support ASP.NET.

I dunno why. I'm just helping a friend and he said ASP.Classic.

Re: ASP.Classic: File uploading...

am 09.04.2008 08:27:19 von Egbert Nierop

"Blue Streak" wrote in message
news:09aacf28-d97c-440f-8860-fdb31f4eaa31@z38g2000hsc.google groups.com...
On Apr 8, 3:32 pm, B@DJJ wrote:
> If at all possible do it with a simple .NET page (called from your Classic
> ASP page) - it's simple, clean, and fast - Classic ASP, I found, is
> terrible
> for file uploads. Looks like everyone answered your OP so I won't add my 2
> cents worth.
>
>
>
> "Blue Streak" wrote:
> > Hi, folks!
>
> > I have scoured the Internet high and low trying to look trying to
> > find a simple example of uploading a file to a server using
> > ASP.Classic. After a lot of searching I think I have it distilled
> > down to its simplest form illustrated in my example. But, alas, it
> > doesn't work :/ Upon further investigation it turns out my example
> > coughs up 0 for Response.TotalBytes causing an error condition.
>
> > So, what am I missing?
>
> > TIA...
>
> > Client side (application.asp):
> >


> > -
> > -
> >
> >
> >

>
> > Server side (submission.asp):
> > <%
> > szFileName = "test.bin"
> > Set adStream = Server.CreateObject("ADODB.Stream")
> > adStream.Type = 1 'adTypeBinary
> > adStream.Open
> > adStream.Write(Response.BinaryRead(Response.TotalBytes))
> > adStream.SaveToFile(szFileName)
> > adStream.Close
> > %>- Hide quoted text -
>
> - Show quoted text -

If it's about small downloads, not for professional usage this script below
can work.








description="Upload file via ASP"
progid="adUpload.WSC"
version="1.00"
classid="{f91cef0f-789d-4106-af7e-e6304e883969}"
>