Mike Kear wrote:
i am been pondering this ideaCarl, the way you're doing it is for a single file at a time. Not that there's anything wrong with that, but if your user has lots of files to upload you'll need to let them have more.But if you run a template with a capacity for 5 uploads, and the user only uploads 3, you'll get errors and/or you'll only see the last file uploaded. Thats why you have to loop over the filenames, giving them unique variable names, and only doing it for the number of files being uploaded. Furthermore, if you hard code it as file1, file2, file3 etc, and the user uploads using the second and third upload field on the form, you'll get an error straight away when the action page looks for file1. Look at the tutorial I put on my site for just this situation. http://afpwebworks.com/index.cfm?fuseaction=DisplayDocument&DocumentID=48 Try it that way first, so you can see what does what, then move the functionality into a CFC. To include the processing in a CFC you dont have to make many changes, and Steve spelled that all out for you. Cheers Mike Kear Windsor, NSW, Australia AFP Webworks http://afpwebworks.com .com,.net,.org domains from AUD$20/Year On Thu, 04 Nov 2004 15:17:48 +1100, Carl <[EMAIL PROTECTED]> wrote: form: You can added as many attachements as you like: <input type="file" name="added_file"><input type="submit" name="attachement" value="Add this attachement"> <br><br> Added Doc's: <ul> <cfloop query="qdoc"> <li>#qdoc.doc_path#</li> </cfloop> </ul> logic <cfif isdefined('added_file') and not isdefined('form.submit')> <cffile action="" destination="#session.filepath#" filefield="form.added_file" nameconflict="makeunique"> <cfquery datasource="+++++"> INSERT INTO review_doc (doc_path, review_id) VALUES ('#file.ServerFile#', 0) </cfquery> </cfif> after form submited <cfif isdefined ("form.Submit")> <cfset desc = #htmlFormatText(form.review)#> <cfquery datasource=+++++"> INSERT INTO review (review_title, review_date, review, username, include_menu_id) VALUES ('#form.review_title#', #createodbcdate(now())#, '#desc#', '#session.mm_username#', #m_include#) </cfquery> <cfquery datasource="++++" name="qreview_id"> SELECT @@IDENTITY AS review_id FROM review </cfquery> <cfquery datasource="+++++"> UPDATE review_doc SET review_id = #qreview_id.review_id# WHERE review_id = 0 </cfquery> just an idea! still an issue that if 2 user's are filling the form out at the same time... but this way you don't have to have a fixed amount of boxes which to me is not the ideal solution as you are leading the user instead of the user doing what the what. thinking i could trap the username as well as setting it to 0 that way i would have the unique user and one user couldn't be filling in the same form in twice. Rob. --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/ |
