Problem with CFFILE upload

andrewaiello
andrewaiello used Ask the Experts™
on
Hey All,

     I am encountering a weird problem with CFFILE.   On a page I have a form with a file type field called attachment:

 <input type="file" name="attachment">

And on the page that handles the post data I have the following code:

<cffile action="upload" destination="D:\Websites\www.jkingsweb.com\ssl\GBT\ProAct\" filefield="attachment" nameconflict="makeunique">


When this goes to execute it throws the following error:

 Attribute validation error for tag CFFILE.
The value of the attribute destination, which is currently "D:\Websites\www.jkingsweb.com\ssl\GBT\ProAct\", is invalid.


I can't understand why this doesn't work as I have virtually the identical code on several other pages involving the same server and it works fine.  I've read that this error sometimes mysteriously pops up and some strange workarounds; but not have worked for me.  Anyone have any idea?  Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
have you tried doing this?

<cffile action="upload"
        destination="#expandPath('.')#\ssl\GBT\ProAct\"
        filefield="attachment"
        nameconflict="makeunique">

use expandPath('.') to build an absolute path to your root, append additional path info to the directory you want.

-tb55

Author

Commented:
I changed the code to:

<cffile action="upload" destination="#expandPath('.')#\ssl\GBT\ProAct\" filefield="attachment" nameconflict="makeunique">

as you suggested and got the same error:

" Attribute validation error for tag CFFILE.
The value of the attribute destination, which is currently "D:\Websites\www.jkingsweb.com\ssl\GBT\ProAct\ssl\GBT\ProAct\", is invalid."

Author

Commented:
Anyone got any ideas?  I've been googling around and trying every approach I can see but none work.  
try doing just this...

<cffile action="upload"
          destination="#expandPath('\ssl\GBT\ProAct\')#"
          filefield="attachment"
          nameconflict="makeunique">

if that doesn't work, are you able to change the name of the directory "www.jkingsweb.com" ?

with many hosts, that directory would be probably named just "jkingsweb.com" without the www prefix. That may be causing an issue with how the directory's being read. Also is that your actual root directory? Where does you wwwroot reside?

-tb55

Author

Commented:
Wow, totally weird;  I changed nothing and it spontaneously works now....guess i wont ask questions.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial