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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE progress bar?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Is there any way while using CFFILE to display a progress bar with the upload status. I know this is possible with ASP, but I was hoping for a CF solution.<br>
<br>
Thanks,<br>
Matt
 
Ok guys, four years have gone by. Surely some one has devised a way to do this by now. Maybe ColdFusion has a new capability with the CFMX or CF50. How do we go about displaying an upload status bar for a CFFILE upload?
 
Not sure how to do it, but I think it is done by using the <CFFLUSH> tag. Sorry I'm not much help, but maybe that will give you something to search for.
 
There are two methods.

It's fairly easy to do one that the status progresses each time a file is uploaded... IE.. say the user selects three files to upload, you can change the progress bar after each upload using cfflush.

You can fake one.. by for instance... summing up all the file sizes... and then updating the progress bar using javascript via cfloop.

But one in cold fusion as the file is actually uploading? I can't see how you'd go about that...

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Found it...

Ben Forta shows how to use <CFFLUSH> to display "Please Wait" types of messages and graphical progress meters before and after lengthy processes in chapter 21 (page 636-638) of his book ColdFusion MX Web Application Construction Kit. The progress meter requires using images via JavaScript.
 
I read the Ben Forta information in chapter 21 of the CFMX WACK. It discusses uploading multiple files and displaying a message between each file using the CFFLUSH tag. It does not discuss a single large file that takes a long time to upload. Is there some way to determine the status of an upload so that the javascript progress meter images can be changed?

With regard to another possibility: has anyone used the Flash UI Components Set 3. They indicate that there is a component "LoadingBox for informing the user what is happening while loading information." Does "loading information" mean uploading a file?
 
Keep reading...

My copy of Ben Forta's CFMX WACK does discuss how to display a graphical progress meter when a particularly long process executes.

Listing 21.9 FlushMeter.cfm - Displaying a Progress Meter by Swapping Images via JavaScript.

This lists code to do this. It appears on page 637.
 
Maybe I'm wrong but here's what I understand, and please read the whole thing through before you reply.

CFFLUSH can flush something to execute a progress bar in a script... So if you're updating 5000 rows, you could do it like this.. (psuedo code)

Code:
<cfoutput>
  <cfloop from="1" to="5000" index="i">
    <Cfquery datasource="#request.dsn#">
      update table
         set field = (#i# * 1012)
       where field = #i#
    </cfquery>
    #i# * 1012 = #(i * 1012)#.<br>
    [red]<cfflush>[/red]
  </cfloop>
</cfoutput>

should dump line by line (ideally... but normally this is not the case... because of connection speeds... but it gets it mostly right).

However you can't put a <cfflush> in the middle of a cffile tag so the cffile tag will do its process before cfflush is reached.

Code:
<cfloop from="1" to="10" index="f">
  <cffile action="write" file="file#f#.txt" output="this is a file.">
  <cfoutput>file #f#<br><br></cfoutput><cfflush>
</cfloop>

In the above, file 1 will be displayed after the first file is written but before the second file is written and file 2 will be displayed after the second and the first files are written but before the third... etc...

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top