<cf_rant type="my2cents">
WHY oh why do people not bother to write a few lines of pseudocode to work out what
they want to do? It saves heaps of time and effort in the long run.
But no, students (generalised by the ones I've had to teach) are LAZY and will re-do
their mistakes over and over again...
this pseudocode took less than 10 min to think about and write and can be converted to
real code in less than 20 min. Fast solution, yes?*
</cf_rant>
Peter, consider this (hopefully the if's line up correctly to read it OK).
if uploadform submitted
get uploaded file
if mime type = allowed and file size < maxSize
check for existing file of same name
if existing file found
save file with temp name
display overwrite_form _
with hidden temp filename and origional filename
else
save file in gallery
display "file Saved OK"
end if
else
display "bad file size or type"
end if
end if
if overwrite_form submitted
get temp filename and origional filename
if choice = "overwrite"
delete origional file
move temp file to gallery
rename temp filename to origional filename
display "file Saved OK"
else
delete temp file
end if
end if
now remember: what will happen if there is an origional file but the overwrite doesn't
happen (lost internet connection, user session times out, etc)? the temp file will sit
there FOREVER! you have lost the "handle" to work with the temp file. Perhaps
CFSCHEDUAL will help here?
ALSO, what will happen if 2 users are wanting to replace the same origional file with
2 diff versions at the same time? who wins?
this is why programming with a connectionless platform is VERY different to a VB app.
In a VB app you can at least clean up on close (unless you blue-screen) but with the
web, the user can just close the browser, bypassing your clean-up. Even sesssion
time-out events are unreliable.
your thoughts?
cheers
barry.b
* Peter, I'm just making a point on how people ask "How do I ..." questions on list.
Don't take it personally.
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004