• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Select a folder for batch upload

Guest
Sep 16, 2010 Sep 16, 2010

Copy link to clipboard

Copied

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.

TOPICS
Advanced techniques

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 17, 2010 Sep 17, 2010

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 19, 2010 Sep 19, 2010

Copy link to clipboard

Copied

LATEST

Thanks a lot ilssac!

Very helpful reply indeed!

I'll most probably resort to a multiple upload module, I've already had a look at the Flex File Uploader.

Thanks again for everything!

Best regards,

Yogesh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation