Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 15th, 2014, 09:24 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default Loop through a single form control collection while uploading file

I remember this issue from a while ago. I never solved it then and now its hitting me in the face again. The code I have inherited uses SoftArtisans.FileUp to upload files. There is a migration and the new requirement is to use Persits.Upload. EG:

Code:
set xyz = Server.CreateObject("Persits.Upload")
In short the page form has two multi line select areas and a file upload. The processing page needs to loop through the number of items which have been selected multi line select area. So using SoftArtisans.FileUp this works:

Code:
'for i = 1 to upl.formex("fieldName").Count
   somevariable = upl.formex("fieldName")(a)
   sql = "..do something with variable..."
Next
but after changing this to use "Persits.Upload" I have unfortunately remembered that it does not have a Count property. I can not figure out any way to fire a loop based on the number of items the user has selected. Form what I can figure only the first selection is available when using Persits.Upload. EG this shows me the first selection :

Code:
response.write upl.form("fieldName")
Is there any way to access the collection of values which the user has selected in a single multi line select area??? Here is the first line of the FOR loops that I have tried, all fail:

Code:
for i = 1 to upl.form("fieldName").Count

for a = 1 to uBound(upl.form("fieldName"))
I have searched the Persits.Upload website, there no mention of this. The only loop example they give is when multiple files are being uploaded. Surely there is a way????? Help...
__________________
Wind is your friend
Matt

Last edited by mat41; January 15th, 2014 at 09:46 PM..
 
Old January 16th, 2014, 05:59 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can't you just loop over upload.Form as described here: http://www.aspupload.com/object_upload.html#Form and check the keys?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 16th, 2014, 03:24 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Hi Imar. I had not found this when I posted. I did find it before the end of the day however it didn't work for me......Anyhow, a new day now and it does work. The solution is
Code:
For Each Item in upl.Form
   If Item.name = "fieldName" Then
      'and now use Item.name
    End If
Next
Thanking you
__________________
Wind is your friend
Matt
 
Old January 17th, 2014, 03:44 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Anyhow, a new day now and it does work.
That's what new days tend to do ;-) Glad to hear it's working.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk uploading a large xml file into single column in table arul1984 SQL Server 2000 1 March 13th, 2009 05:15 AM
uploading file to a remote IP using upload control abhishekkashyap27 C# 2005 4 June 27th, 2008 07:50 AM
Loop through form looking for Combo Control feets Access VBA 3 November 20th, 2007 09:17 AM
Collection-based for loop troubles... stidle BOOK: Beginning Java 2, JDK 5 Edition 0 February 13th, 2006 08:52 PM
Sending Form Collection To *base.cs file bsausser ASP.NET 1.0 and 1.1 Basics 11 February 12th, 2004 03:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.