Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<CFFILE> I don't get it. 1

Status
Not open for further replies.

KevinFSI

Programmer
Nov 17, 2000
582
US
I'm trying to use <CFFILE ACTION=&quot;Upload&quot;...> to allow the users to upload image files to my server. I don't really understand how to use it though.

Do I still need <INPUT TYPE=&quot;file&quot;...> in my form, or is <CFFILE> supposed to replace that?

Any help would be greatly appreciated.

Thanks, Kevin
slanek@ssd.fsi.com
 
Hey Kevin,

To upload a file from a web page, you need to have a file input box and add this to your form tag &quot; enctype=&quot;multipart/form-data&quot;&quot;.

Here's an example.

<form method=&quot;post&quot; action=&quot;upload.cfm&quot; enctype=&quot;multipart/form-data&quot;>
<input type=&quot;file&quot; name=&quot;f1&quot;>
<input type=&quot;submit&quot;>
</form>

On the upload.cfm page, you just need this.

<cffile
action=&quot;upload&quot;
filefield=&quot;f1&quot;
destination=&quot;c:\temp\&quot;
nameconflict=&quot;makeunique&quot;
>

This will take the file sent by the browser, store it in the c:\temp directory and rename it if necessary.

Let me know if you have any problems,
GJ
 
I've said it before, you da man! That was the missing step. enctype=&quot;multipart/form-data&quot;. I haven't seen that in anything I've read. Kevin
slanek@ssd.fsi.com
 
Glad I could help :) That enctype is an html oddity. I don't think it's used for much outside of file uploads. I think I had done html for years before I ever ran across it.

Take care,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top