There is a file uloader on asfusion.com that might be what you want.

Regards
Russ Michaels
www.michaels.me.uk
www.cfmldeveloper.com - Free CFML hosting for developers
www.cfsearch.com - CF search engine
On 12 May 2013 02:07, "Dave Watts" <[email protected]> wrote:

>
> > When a user tries to upload a file into the depo, I'm checking to see if
> there's already a file with that name. If there IS, the offer them a choice
> to cancel, or overwrite.
> >
> > So, something like
> >
> > <cffile action="UPLOAD" filefield="doc" destination="C:\MyPart\temp\"
> ... blah />
> >
> > <cfif FileExists("C:\MyPart\#filetoupload#") > <!--- this works - no
> problem --->
> >
> > <!--- here's where I get into trouble I need to do the pseudo code below
> --->
> >
> > <!--- SHOW AN ALERT HERE: --->
> > THERE'S ALREADY A FILE WITH THIS NAME. DO YOU WANT TO OVERWRITE?
> >   Choice NO {
> >       <!--- STOP PROCESSING AND RETURN TO THE ORIGINAL FORM ---> }
> >   Choice YES {
> >       <!--- UPLOAD/MOVE the file where it needs to go and overwrite the
> original ---> }
> >
> > <cfelse> <!--- there's not a duplicate, so do your file stuff --->
> >
> >    <cffile action="upload" ... blah  />
> >
> > </cfif>
> >
> > I've tried various javascript alerts ... but CF either keeps processing
> past the alert, or just does nothing with it... like:
> >
> >  <script type="text/javascript">
> >    ! function makesure() {
> >     if (confirm('Overwrite?')) {
> >        return true;
> >      } else {
> >      alert('Deletion of this item cancelled.');
> >          window.location = 'test_files.cfm';
> >     return false;
> >     }
> >    }();
> >  </script>
>
> Functions don't run automatically in JavaScript (or most other
> languages). They need to be called.
>
> But there's a more fundamental problem, as well. You won't be able to
> do all of this in a single program called a single time, because CF
> does all of its processing before anything is returned to the client.
> So, basically, your program flow will have to look like this:
>
> 1. User runs first CF script that lets them choose a file to be uploaded.
> 2. User POSTs data to second CF script.
> 3. Second CF script returns "file already exists" message to user if
> appropriate.
> 4. User runs third CF script to overwrite the file.
>
> Now, of course, you can actually include all of these in one file if
> you like, but there will be three CF program executions in sequence to
> get where you're going.
>
> And, of course, you could check for the existence of the file before
> you upload it, via an AJAX call to yet another CF program execution.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> http://training.figleaf.com/
>
> Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
> GSA Schedule, and provides the highest caliber vendor-authorized
> instruction at our training centers, online, or onsite.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355722
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to