[thelist] ColdFusion Folder Upload

jon steele jjsteele22 at yahoo.com
Sun May 20 15:54:39 CDT 2001


Hello,

I need to upload an entire directory/folder in ColdFusion. I tried
putting the folder in a variable then set that as the FILEFIELD in the
CFFILE tag, like this:

<cfset fullpath = "C:\myfolder"
<cffile action="UPLOAD" filefield="fullpath"
destination="#destination#" nameconflict="ERROR">

But that gave a "filefield does not contain an uploaded file" error.

Then I tried a different approach. I would create the directory, get a
list of the contents of the folder from the user's pc, then use a loop
to upload the files, like this:

<cfdirectory action="CREATE" directory="#destination#">
<cfdirectory action="LIST" directory="#fullpath#" name="files">
<cfloop from="3" to="#files.RecordCount#" index="i">
  <cffile action="UPLOAD" filefield="#files.name[i]#"
destination="#destination#" nameconflict="ERROR">
</cfloop>

But that gave an error too.

So then I thought that maybe the files need to come from an <input
type="file"> field, you know, for security reasons. So then I made a
page which would loop out several <input type="file"> fields with
preset values, then submit the form with JavaScript
(document.formname.submit()). Then, on the receiving end, I would loop
through the form values and upload the files.

This gave an error too.

If my approaches were overcomplicating the problem, please tell me.

I'm at a loss here. Can anyone please help me. What I need, again, is
to *upload an entire directory*.

Thank You.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




More information about the thelist mailing list