ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 9th, 2003, 04:02 AM
Vantera Vantera is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: South Coast of NSW, Australia
Posts: 108 Vantera User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Vantera
Conditional uploading with Persits ASPUpload

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.
__________________
Kind Regards,
John Rebbeck
john@interspire.com
ICQ# 74637937

Reply With Quote
  #2  
Old July 16th, 2003, 11:54 PM
numbernine numbernine is offline
Up To His Eyes In Ads
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Chicago
Posts: 160 numbernine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 25 sec
Reputation Power: 7
I had a lot of trouble doing something similar a while ago. I wound up relying heavily on this article. Basically you binaryread everything into a variable and then parse that looking for your form fields.

http://msdn.microsoft.com/library/d...tml/asp0900.asp

I've found this sort of thing to be a breeze in .NET, so if that's an option I'd go for it.

Reply With Quote
  #3  
Old July 18th, 2003, 02:20 PM
wes wes is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 24 wes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The way I handle all my self posting forms is a quick and easy solution to part of your problem. Rather than checking the value of a button to see if it has been posted, append a query string "Action" variable to your form action. You can then access the query string as usual.

Ex:
action="upload.asp?Action=DoUpload"

Since this will only work with a single method form, I suggest you do some JS work on the form page to manage the two button approach. You could change your buttons to "button" rather than "submit" type, then have them run some Javscript to set the appropriate action on the upload form. You can't just use hidden upload forms because scripting is blocked on file fieds.

Last edited by wes : July 18th, 2003 at 02:24 PM.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Conditional uploading with Persits ASPUpload


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT