I'm working on building a document. Got almost everything working perfect,
except ...
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>
There's GOT TO BE A BETTER WAY!! Anybody got a link to a good tutorial or
anything for this? So far, I've not turned up anything on Google that works...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:355716
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm