Re: Brain not working... how do I get these values?

2008-03-21 Thread Matt Williams
On Thu, Mar 20, 2008 at 11:13 PM, Rick Faircloth
[EMAIL PROTECTED] wrote:
  I'll get on the jQuery list, which is the library I'm using
  to perform the form field additions and find out how to implement
  the counter.

Rick,

You don't really need a counter. Just do something like (not checking
syntax here...):
cfloop collection=#form# item=FieldName
  cfif Left(FieldName,5) EQ file_
cffile action=upload fileField=#FieldName# destination=...
[otherattributes] /
  /cfif
/cfloop

-- 
Matt Williams
It's the question that drives us.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301733
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Brain not working... how do I get these values?

2008-03-21 Thread Rick Faircloth
Sounds like a good idea, Matt.

I'll give that a try!

Thanks!

Rick

 -Original Message-
 From: Matt Williams [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 21, 2008 7:49 AM
 To: CF-Talk
 Subject: Re: Brain not working... how do I get these values?
 
 On Thu, Mar 20, 2008 at 11:13 PM, Rick Faircloth
 [EMAIL PROTECTED] wrote:
   I'll get on the jQuery list, which is the library I'm using
   to perform the form field additions and find out how to implement
   the counter.
 
 Rick,
 
 You don't really need a counter. Just do something like (not checking
 syntax here...):
 cfloop collection=#form# item=FieldName
   cfif Left(FieldName,5) EQ file_
 cffile action=upload fileField=#FieldName# destination=...
 [otherattributes] /
   /cfif
 /cfloop
 
 --
 Matt Williams
 It's the question that drives us.




~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301737
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Brain not working... how do I get these values?

2008-03-21 Thread Rick Faircloth
Well... the results are mixed.  I posted this over on the jQuery list, too,
in case it was more of a jQuery problem than CF.

But I've copied the post below, if you have time to look at it.

Thanks for your help!

Rick


Hi, all.

Well, I'm still on the path of trying to create a file input cloning system,
with CF as the server-side processor.

I'm having mixed results.

FF2 just returns to the page with no uploads or errors.

IE7 uploads a file for the first filefield, but, even when there is no
second field that has been added via JS, I get an error stating that
The form field 'IMAGE-UPLOAD-2' did not contain a file.

Well, form field 'IMAGE-UPLOAD-2' wouldn't contain a file, because I hadn't
click on the link connected to the JS that would have created a form field
called 'IMAGE-UPLOAD-2'. IE seems to think that form field exists, when it 
doesn't.

I've included my jQuery below and the CF and HTML.
If anyone could take a look and see if you spot a problem, please do.

If it will help, I'll re-create this page online.

Thanks for any help!

Rick

jQuery:

$(document).ready(function() {
$('#add-image').click(function() {
$('#image-next').clone(true).
attr('name', function() {
return this.name.replace(/(.+)(\d+$)/, function(s, p1, 
p2) {
return p1 + (parseInt(p2, 10) + 1);
})
})
.insertAfter('#image-div :last');
});
});


CF for processing form when submitted:

cfif isDefined(form.fieldnames)

cfloop collection=#form# item=fieldname
cfoutput
#fieldname# - #form[fieldname]#br
/cfoutput

cfif left(#fieldname#, 5) eq image

cffile action=upload filefield=#fieldname#
destination=e:\inetpub\webroot\test
  accept=image/jpg, image/pjpg, image/jpeg, 
image/pjpeg
nameconflict=makeunique

/cfif 

/cfloop

/cfif


Relevant HTML:

ul
liClick the browse button to locate an image./li
   liUse the Add New Image Field button below to create addition 
image input
fields./li
/ul

div style=margin-left:60px;

form name=add-image-form action=#cgi.script_name# method=post
enctype=multipart/form-data

div id=image-input
div id=image-div
input style=margin-bottom:25px; display:block; 
id=image-next
name=image-upload-2 type=file size=60 value=
/div
/div

pa id=add-image href=#Add New Image Field/p

input name=submit type=submit value=Submit Form

/form

/div



 -Original Message-
 From: Rick Faircloth [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 21, 2008 8:54 AM
 To: CF-Talk
 Subject: RE: Brain not working... how do I get these values?
 
 Sounds like a good idea, Matt.
 
 I'll give that a try!
 
 Thanks!
 
 Rick
 
  -Original Message-
  From: Matt Williams [mailto:[EMAIL PROTECTED]
  Sent: Friday, March 21, 2008 7:49 AM
  To: CF-Talk
  Subject: Re: Brain not working... how do I get these values?
 
  On Thu, Mar 20, 2008 at 11:13 PM, Rick Faircloth
  [EMAIL PROTECTED] wrote:
I'll get on the jQuery list, which is the library I'm using
to perform the form field additions and find out how to implement
the counter.
 
  Rick,
 
  You don't really need a counter. Just do something like (not checking
  syntax here...):
  cfloop collection=#form# item=FieldName
cfif Left(FieldName,5) EQ file_
  cffile action=upload fileField=#FieldName# destination=...
  [otherattributes] /
/cfif
  /cfloop
 
  --
  Matt Williams
  It's the question that drives us.
 
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301756
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Brain not working... how do I get these values?

2008-03-21 Thread Matt Williams
On Fri, Mar 21, 2008 at 11:34 AM, Rick Faircloth
[EMAIL PROTECTED] wrote:
   pa id=add-image href=#Add New Image Field/p

  input name=submit type=submit value=Submit Form

Bad HTML. Put in closing /a after Add New Image Field

should work after that.

-- 
Matt Williams
It's the question that drives us.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301757
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Brain not working... how do I get these values?

2008-03-21 Thread Rick Faircloth
Great!  Thanks, Matt!
That seems to have solved all the problems.
Oh, for the want of a nail!

Rick

 -Original Message-
 From: Matt Williams [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 21, 2008 1:04 PM
 To: CF-Talk
 Subject: Re: Brain not working... how do I get these values?
 
 On Fri, Mar 21, 2008 at 11:34 AM, Rick Faircloth
 [EMAIL PROTECTED] wrote:
pa id=add-image href=#Add New Image Field/p
 
   input name=submit type=submit value=Submit Form
 
 Bad HTML. Put in closing /a after Add New Image Field
 
 should work after that.
 
 --
 Matt Williams
 It's the question that drives us.
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301758
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Brain not working... how do I get these values?

2008-03-20 Thread Rick Faircloth
Ok. so I'm trying, for the first time, to set up
unlimited file inputs for users.

I'm using a jQuery plug-in, which works fine.

What I can't figure out is how to get the values
for the image fields so I can loop over them in
the cffile and query actions.

When I try to cfoutput the field values, e.g., values
from multiple file fields called image, I get the value
returned as:

C:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp26159.tmp

It's a single value, not multiple values.  I assume all the values
are wrapped up in the data in that temp file.

I have always worked with one file field input per value, so I'm a little
lost on how to get the values I need?

Anyone care to straighten out the confused one?

Rick



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301721
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Brain not working... how do I get these values?

2008-03-20 Thread James Holmes
Can you name the file fields independently (i.e. do they have to be
the same name)?

On Fri, Mar 21, 2008 at 11:45 AM, Rick Faircloth
[EMAIL PROTECTED] wrote:
 Ok. so I'm trying, for the first time, to set up
  unlimited file inputs for users.

  I'm using a jQuery plug-in, which works fine.

  What I can't figure out is how to get the values
  for the image fields so I can loop over them in
  the cffile and query actions.

-- 
mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301723
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Brain not working... how do I get these values?

2008-03-20 Thread Rick Faircloth
Well, at first I did work out a way (with some help!) to us JS
to generate the additional file fields and give each one a
unique name, however, I realized that since the user is generating
the inputs and the input's name, I would have to automatically
generate some CFML to correspond to the generated file fields for processing.

For example, with a comma-delimited list of file field names, I could use
a loop with for=1 to len(comma-delimited list) (pseudo code) and loop through
the file names for cffile processing and inserting into a db.

However, with uniquely name fields being created by the user, how would I
let CF know how many fields it needed to process?  If I know how many file 
fields
a user created, I would know exactly what the field names would be, because
the JS increments the names starting with image-upload-1, then image-upload-2, 
etc.

So, how would I handle the processing not knowing the number of fields being 
passed
by the form to CF?

Rick



 -Original Message-
 From: James Holmes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 20, 2008 11:25 PM
 To: CF-Talk
 Subject: Re: Brain not working... how do I get these values?
 
 Can you name the file fields independently (i.e. do they have to be
 the same name)?
 
 On Fri, Mar 21, 2008 at 11:45 AM, Rick Faircloth
 [EMAIL PROTECTED] wrote:
  Ok. so I'm trying, for the first time, to set up
   unlimited file inputs for users.
 
   I'm using a jQuery plug-in, which works fine.
 
   What I can't figure out is how to get the values
   for the image fields so I can loop over them in
   the cffile and query actions.
 
 --
 mxAjax / CFAjax docs and other useful articles:
 http://www.bifrost.com.au/blog/
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301724
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Brain not working... how do I get these values?

2008-03-20 Thread James Holmes
Call them file_x_ where x is the number of this field, while keeping
a running tally (using JS) of fields in a hidden form field
hid_filecount (all of which gets submitted in the form).

Then you can loop through input file_1, file_2 etc through to x, which
is the value of hid_filecount.

On Fri, Mar 21, 2008 at 12:41 PM, Rick Faircloth
[EMAIL PROTECTED] wrote:
 Well, at first I did work out a way (with some help!) to us JS
  to generate the additional file fields and give each one a
  unique name, however, I realized that since the user is generating
  the inputs and the input's name, I would have to automatically
  generate some CFML to correspond to the generated file fields for processing.

  For example, with a comma-delimited list of file field names, I could use
  a loop with for=1 to len(comma-delimited list) (pseudo code) and loop through
  the file names for cffile processing and inserting into a db.

  However, with uniquely name fields being created by the user, how would I
  let CF know how many fields it needed to process?  If I know how many file 
 fields
  a user created, I would know exactly what the field names would be, because
  the JS increments the names starting with image-upload-1, then 
 image-upload-2, etc.

  So, how would I handle the processing not knowing the number of fields being 
 passed
  by the form to CF?

  Rick





   -Original Message-
   From: James Holmes [mailto:[EMAIL PROTECTED]
   Sent: Thursday, March 20, 2008 11:25 PM
   To: CF-Talk
   Subject: Re: Brain not working... how do I get these values?
  
   Can you name the file fields independently (i.e. do they have to be
   the same name)?
  
   On Fri, Mar 21, 2008 at 11:45 AM, Rick Faircloth
   [EMAIL PROTECTED] wrote:
Ok. so I'm trying, for the first time, to set up
 unlimited file inputs for users.
   
 I'm using a jQuery plug-in, which works fine.
   
 What I can't figure out is how to get the values
 for the image fields so I can loop over them in
 the cffile and query actions.
  
   --
   mxAjax / CFAjax docs and other useful articles:
   http://www.bifrost.com.au/blog/
  
  


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301725
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Brain not working... how do I get these values?

2008-03-20 Thread Rick Faircloth
Thanks, James.

I'll get on the jQuery list, which is the library I'm using
to perform the form field additions and find out how to implement
the counter.

Rick

 -Original Message-
 From: James Holmes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 20, 2008 11:48 PM
 To: CF-Talk
 Subject: Re: Brain not working... how do I get these values?
 
 Call them file_x_ where x is the number of this field, while keeping
 a running tally (using JS) of fields in a hidden form field
 hid_filecount (all of which gets submitted in the form).
 
 Then you can loop through input file_1, file_2 etc through to x, which
 is the value of hid_filecount.
 
 On Fri, Mar 21, 2008 at 12:41 PM, Rick Faircloth
 [EMAIL PROTECTED] wrote:
  Well, at first I did work out a way (with some help!) to us JS
   to generate the additional file fields and give each one a
   unique name, however, I realized that since the user is generating
   the inputs and the input's name, I would have to automatically
   generate some CFML to correspond to the generated file fields for 
  processing.
 
   For example, with a comma-delimited list of file field names, I could use
   a loop with for=1 to len(comma-delimited list) (pseudo code) and loop 
  through
   the file names for cffile processing and inserting into a db.
 
   However, with uniquely name fields being created by the user, how would I
   let CF know how many fields it needed to process?  If I know how many file 
  fields
   a user created, I would know exactly what the field names would be, because
   the JS increments the names starting with image-upload-1, then 
  image-upload-2, etc.
 
   So, how would I handle the processing not knowing the number of fields 
  being passed
   by the form to CF?
 
   Rick
 
 
 
 
 
-Original Message-
From: James Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2008 11:25 PM
To: CF-Talk
Subject: Re: Brain not working... how do I get these values?
   
Can you name the file fields independently (i.e. do they have to be
the same name)?
   
On Fri, Mar 21, 2008 at 11:45 AM, Rick Faircloth
[EMAIL PROTECTED] wrote:
 Ok. so I'm trying, for the first time, to set up
  unlimited file inputs for users.

  I'm using a jQuery plug-in, which works fine.

  What I can't figure out is how to get the values
  for the image fields so I can loop over them in
  the cffile and query actions.
   
--
mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/
   
   
 
 
 
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301726
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4