Skip navigation
Currently Being Moderated

Select a folder for batch upload

Sep 17, 2010 6:27 AM

Hi,

 

Is it possible to select a folder using CF?

 

I'm trying to implement a batch upload and processing module and I'd like the user to select a folder containing all the files that need to be uploaded, instead of either selecting each file one by one, or doing multiple upload.

 

Even if it's multiple upload, the user still has to choose each file manually.

 

The idea is to automate this process to the maximum to reduce human intervention to the strict minimum.

 

After the user has selected his/her folder and clicked on the Submit button, the program needs to copy all the files from the user's source folder to a destination folder on the server and then make use of cfdirectory to list all the files and process each one. This is not a problem. I have tested the following with a hard-coded directory and it works great!

 

<!--- List files in the selected directory --->

<cfdirectory directory="#variables.selectedDirectory#" action="list" name="qDir">

<!--- Loop directory --->
<cfoutput query="variables.qList">

     <!--- Invoke method to process each file in the directory --->
     <cfinvoke method="processFileUpload" returnvariable="qDone">
          <cfinvokeargument name="selectedFile" value="#variables.qDir.name#">
     </cfinvoke>

</cfoutput>

 

The above is working already.

 

Now, to be able to automate the file copy process from the user's source folder to the destination folder on the server, I need to provide the user with a form where he/she can point to his/her source folder.

 

How can we do this in CF?

 

Thanks in advance.

 

Regards,

Yogesh.

 
Replies
  • Currently Being Moderated
    Sep 17, 2010 8:01 AM   in reply to YogeshM

    YogeshM wrote:

     

    How can we do this in CF?

     

    For CF to be able to do it, you have to be able to do it from the server.  IF you can log in to the ColdFusion server, and from that server go to 'Network Locations" and browse to a clients computer.  Then ColdFusion can do this, using the same UNC path you used in Network Locations.  This might be possible on a local network which one might have at some company or other oranizations.

     

    But CF can NOT see what is on the client machine through HTTP.  First of all, ColdFusion is not even talking to the client, the web server (IIS or Apache) is what talks the client.  ColdFusion is talking to the web server.  Secondly the HTTP protocol is designed to prevent exactly this type of interaction for security reasons.  IF one could do what you want to do with HTTP, it would be trivially easy for evil programmers to make web sites that trick users to upload all types of sensetive information.

     

    There are some client technolgoies that MIGHT do what you want.  Flash, JavaScript, is what you would need to be looking for, but usually these don't all just pointing at an entire directory, again for security reasons.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points