Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upload 1 File to Many Directories Using 1 Upload Form

Status
Not open for further replies.

chlebicki

Technical User
Jul 4, 2006
31
US
Hi,

I am trying to upload one file to multiple directories using one file upload form. The directories are alreay created and based on the product's id, where the directories are to be uploaded to are based on a recordset.

I tried using a <cf query> and inserting the file upload inside of it, but that would generate multiple file upload fields... I just need one.

Is there a way to store multiple values in a variable and then recall that variable 1 value at a time? Any other suggestions?

Thanks,
Craig
 
<cfloop> should do the job my friend.

If you're generating the directories from a Query then you should be able to loop those results in order to upload the file to a few directories, changing the detination of the <cffile> using a variable from the query.

I use this approach to loop a <cfftp> command and it works nicly.

Thanks,

Rob
 
Rob,

I thought of using a cfloop but the <cf query> loops by default, correct? How do I get it to loop via a cfloop and with a cf query without creating numerous file upload fields?

Here is a glance of my current code:

<cfoutput query="rsPamInformation">

<cfif isdefined("form.upload_#rsPamInformation.PAM_ID#")>
<cffile accept="image/*" action="upload"
destination="C:\Documents and Settings\Craig\Desktop\PAM Uploaded Files\#rsPamInformation.PAM_ID#" filefield="upload_#rsPamInformation.PAM_ID#"
nameconflict="makeunique">
<cfset Success="#rsPamInformation.PAM_ID#">
</cfif>


I know multiple file upload fields are being generated because the filefield name is dynamic and changes with the cfquery, but can't keep that static because it has to pass the cfif defined arguement.

Any ideas?

Thanks for your help,
Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top