Problem with Persits ASPUpload

J

John Rebbeck

(sorry about cross posting but I really need help with this and it fits in
both newsgroups)

I'm creating a little image manager and I'm using Persits ASPUpload. I have
an UploadButton and DeleteButton which are both submits. Normally I would
do:


code:-----------------------------------------------------------------------
-------
If Request.Form("UploadButton") <> "" Then
' perform the upload
Else If Request.Form("DeleteButton") <> "" Then
' perform deletion
End If
----------------------------------------------------------------------------
--

....but as some of you may know you can't use Request.Form when using
ASPUpload because the form requires have the enctype="multipart/form-data"
attribute which makes Request.Form unavailable.

It is however possible to access it like:

code:-----------------------------------------------------------------------
-------
Dim upload : Set upload = Server.CreateObject("Persits.ASPUpload")
upload.Save("c:\somewhere")
Response.Write(upload.Form("UploadButton")) ' writes the value of
UploadButton
----------------------------------------------------------------------------
--

....but I want to only perform the upload when the upload button has been
clicked. To access upload.Form(...) to check if the button has been clicked
you must first call upload.Save, which uploads the files and populates the
upload.Form property.

This is a strange problem. I'm sure I could get around it by uploading to a
temp dir and then copying to the final directory if the upload button has
been clicked, or upload them then delete them again if upload button was not
clicked, but I shouldn't have to.

Anyone got any ideas? I'm probably missing something simple, I hope so.

Thanks in advance.
 
D

Dave Anderson

John Rebbeck said:
...but as some of you may know you can't use Request.Form
when using ASPUpload because the form requires have the
enctype="multipart/form-data" attribute which makes
Request.Form unavailable...

...but I want to only perform the upload when the upload
button has been clicked. To access upload.Form(...) to
check if the button has been clicked you must first call
upload.Save, which uploads the files and populates the
upload.Form property.

..Anyone got any ideas? I'm probably missing something
simple, I hope so.

What is preventing you from using two different forms or changing the form
action & enctype at submission?

http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/action.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/enctype.asp


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
J

Joe Iano

It's not clear to me why you are uploading anything when the user chooses to
do a deletion. Perhaps your form needs to be organized differently?

(sorry about cross posting but I really need help with this and it fits in
both newsgroups)

I'm creating a little image manager and I'm using Persits ASPUpload. I have
an UploadButton and DeleteButton which are both submits. Normally I would
do:


code:-----------------------------------------------------------------------
-------
If Request.Form("UploadButton") <> "" Then
' perform the upload
Else If Request.Form("DeleteButton") <> "" Then
' perform deletion
End If
----------------------------------------------------------------------------
--

....but as some of you may know you can't use Request.Form when using
ASPUpload because the form requires have the enctype="multipart/form-data"
attribute which makes Request.Form unavailable.

It is however possible to access it like:

code:-----------------------------------------------------------------------
-------
Dim upload : Set upload = Server.CreateObject("Persits.ASPUpload")
upload.Save("c:\somewhere")
Response.Write(upload.Form("UploadButton")) ' writes the value of
UploadButton
----------------------------------------------------------------------------
--

....but I want to only perform the upload when the upload button has been
clicked. To access upload.Form(...) to check if the button has been clicked
you must first call upload.Save, which uploads the files and populates the
upload.Form property.

This is a strange problem. I'm sure I could get around it by uploading to a
temp dir and then copying to the final directory if the upload button has
been clicked, or upload them then delete them again if upload button was not
clicked, but I shouldn't have to.

Anyone got any ideas? I'm probably missing something simple, I hope so.

Thanks in advance.
 
J

John Rebbeck

I solved it by using 2 forms, but even then it was a pain. I had to submit
one of the forms to another file which is not consistent with the rest of
the site (oh well, it works).

Thanks
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top