Mark,
This reminds me of a similar problem with CFFILE under CFMX. It appears
there is a few seconds delay when running CFFILE operations, so if you
perform one CFFILE action immediately after another, the first action may
not have finished when the second action commences. CFFILE does not seem to
operate synchronously with your program, so if one CFFILE steps depends on
the completion of an earlier step, you could be in trouble. Only happens
only with CFMX though. Earlier CF versions don't have this behaviour.

My problem was issuing CFFILE ACTION="DELETE" to delete an existing file,
followed by CFFILE ACTION="RENAME" to rename a new file to the same name as
the file just deleted. The rename operation always failed (Access denied).
But if I retry the operation, the rename works. I happened to have Windows
Explorer opened on the directory when I ran the program. I could see the
file still for a few seconds after the program that supposedly deleted it
finished. So because the file still physically existed, the rename failed.
So I thought, I'll check for FileExists to ensure the old file is gone
before renaming, but that doesn't solve the problem. CF thinks the file is
gone, but it fails at the file system level.

Maybe in your case, the first step (moving to the temp directory) was not
completed when the program attempted to move it again to the final
directory. Verifying the existence of the file before moving it won't help,
as per my experience. It will fail at the physical file system level. I'm
guessing that your readFormField and contentPut run one immediately after
the other with no interruption?

How did I solve the problem? Seeing no easy way to get around it, I made it
a 2-step process and disguised the shortcoming as a feature (the fine art of
marketing!). The first run moves the old file to a "trash" directory, and
returns a confirmation page. The user then clicks "OK" to execute step 2
which renames the new file. If the user clicks "Restore", step 2 just moves
the old file back from trash. Maybe you do something similar with your 2
modules.

Regards: Ayudh

+--------------------------------------------------------------+
| Turn on your Revenue Stream...                               |
| Bolt on a Virtual Cash Register to your e-commerce site now. |
| VeriPay from Xilo Online: http://www.xilo.com                |
+--------------------------------------------------------------+

----- Original Message -----
From: "Mark Woods" <[EMAIL PROTECTED]>
To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 20:24
Subject: [cfaussie] odd cffile issue with CFMX


> I'm having some weird problems with cffile and cfmx, the code worked fine
> with cf5...
>
> I'm uploading a file by posting to a cf template that runs two modules for
> each uploaded file, readFormField and contentPut.
>
> readFormField uploads the file and moves it to the temp directory for that
> application. This works fine every time, the file is always uploaded and
> moved successfully.
>
> contentPut checks the temp directory for a matching uploaded file and
moves
> it to it's destination directory (a secure or public assets directory).
> This part fails most of the time but not always.
>
> I get a cffile error...
> Attribute validation error for tag CFFILE. The value of the attribute
> source, which is currently "blah", is invalid.
>
> Now, I've done some debugging, and the source file and destination
> directories exist even when I get this error. Also, if I re-post the form
a
> few times it'll eventually work. And, if I change the action attribute of
> cffile from "move" to "copy" it works fine every time.
>
> My guess is that it's something to do with the fact that I have two
modules
> running for the uploaded files and readFormField still has the file locked
> for writing while contentPut is trying to move it. Well, the file always
> exists and copying it works fine, but I need to move it or else I'm left
> with rubbish in my temp directory.
>
> Anyone got any idea how I'm going to solve this without some ugly
> workaround like a scheduled temp cleanup?
>
>
> Thanks
>
> Mark
>
>
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MX Downunder AsiaPac DevCon - http://mxdu.com/


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to