469,085 Members | 1,042 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,085 developers. It's quick & easy.

Cannot use Request.Form?

I try to use script from www.freeaspupload.net for upload file.
I need to store in session object the names of uploaded files but I get an
error - Cannot use Request.Form collection after calling BinaryRead
How can I make it?

Part of this script:

<form name="frmSend" method="POST" enctype="multipart/form-data"
action="upload_file.asp" onSubmit="return onSubmitForm();">
<span>File 1 :</span> <input type="file" name="file" size="35"
class="form"><br><br>
<span>File 2: </span><input type="file" name="file_2" size="35"
class="form"><br><br>
<input type="submit" value="Submit" class="form">
</form>
....
..
....
<%

function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)

' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function

SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then

for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & ""
next
else
SaveFiles = "no file."
end if
end function
Session("file") = SaveFiles
'#### ###

Session("file") = Trim(Request.Form("file"))
Session("file_2") = Trim(Request.Form("file_2"))

'#### ###
Thx for help
Jul 22 '05 #1
4 5560
Generally the upload compoent provides its own Form collection that you
should use instead of the usual Request.Form collection (check the
documentation for your component).
My understanding is that this is because upload components are parsing
themselves all the incoming data making then the regular collection
unavailable...

--
Patrice

"Zibi" <no****@won.com> a écrit dans le message de
news:db**********@nemesis.news.tpi.pl...
I try to use script from www.freeaspupload.net for upload file.
I need to store in session object the names of uploaded files but I get an error - Cannot use Request.Form collection after calling BinaryRead
How can I make it?

Part of this script:

<form name="frmSend" method="POST" enctype="multipart/form-data"
action="upload_file.asp" onSubmit="return onSubmitForm();">
<span>File 1 :</span> <input type="file" name="file" size="35"
class="form"><br><br>
<span>File 2: </span><input type="file" name="file_2" size="35"
class="form"><br><br>
<input type="submit" value="Submit" class="form">
</form>
...
.
...
<%

function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)

' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function

SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then

for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & ""
next
else
SaveFiles = "no file."
end if
end function
Session("file") = SaveFiles
'#### ###

Session("file") = Trim(Request.Form("file"))
Session("file_2") = Trim(Request.Form("file_2"))

'#### ###
Thx for help

Jul 22 '05 #2

Użytkownik "Patrice" <no****@nowhere.com> napisał w wiadomości
news:%2****************@TK2MSFTNGP15.phx.gbl...
Generally the upload compoent provides its own Form collection that you
should use instead of the usual Request.Form collection (check the
documentation for your component).
My understanding is that this is because upload components are parsing
themselves all the incoming data making then the regular collection
unavailable...


Documentation is very bearing.
There is written:
Public properties:

ContentType, FileName, Length.
No methods.

So it's not possible?


Jul 22 '05 #3
The properties you looked are for the UploadedFile file class.

According to http://www.freeaspupload.net/freeasp...umentation.asp
you do have a Form collection for the FreeASPUpload class. Try to use this
collection instead...

--
Patrice

"Zibi" <no****@won.com> a écrit dans le message de
news:db**********@nemesis.news.tpi.pl...

Użytkownik "Patrice" <no****@nowhere.com> napisał w wiadomości
news:%2****************@TK2MSFTNGP15.phx.gbl...
Generally the upload compoent provides its own Form collection that you
should use instead of the usual Request.Form collection (check the
documentation for your component).
My understanding is that this is because upload components are parsing
themselves all the incoming data making then the regular collection
unavailable...


Documentation is very bearing.
There is written:
Public properties:

ContentType, FileName, Length.
No methods.

So it's not possible?

Jul 22 '05 #4
Zibi wrote:
Użytkownik "Patrice" <no****@nowhere.com> napisał w wiadomości
news:%2****************@TK2MSFTNGP15.phx.gbl...
Generally the upload compoent provides its own Form collection that
you should use instead of the usual Request.Form collection (check
the documentation for your component).
My understanding is that this is because upload components are
parsing themselves all the incoming data making then the regular
collection unavailable...


Documentation is very bearing.
There is written:
Public properties:

ContentType, FileName, Length.
No methods.

So it's not possible?


See:

http://www.freeaspupload.net/freeasp...umentation.asp

Especially this part:
**********************************************
This page will receive the information from the form, save the uploaded
files,
and process any other fields in your form.
<snip>
To process other fields in the form, use the Form collection

of the upload object the same way you would use the Form collection of the
Request object. For example, if your form had a text element named UserName,
your processing code would include:
strUserName = Upload.Form("UserName")
**********************************************

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Christopher Brandsdal | last post: by
5 posts views Thread by rathnesh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.