I have searched everywhere for a way to use cffile to upload a file. The catch is that I have file names stored in a database and want to upload the file without having to browse or type the file name into a cfinput type=file for use in a cffile tag. I can't find how to preload the name into the file input tag. The code for the form is:
CODE
<script Language=JavaScript>
function UploadPhoto(vFileName){
document.forms.UploadPhoto.FileName.text = vFileName;
document.forms.UploadPhoto.submit();
}
</Script>
<cfelseif isdefined("form.UploadPhoto")>
<cfoutput>
<cfform name="UploadPhoto"action="uploadfile.cfm"
enctype="multipart/form-data" method=post>
<cfinput name="FileName" size=50 type="file" />
<cfinput name="SubmitForm"
type=submit value="Upload the File" />
</cfform>
<script Language=JavaScript>
UploadPhoto("#form.PictureFileName#");
</Script>
</cfoutput>
</cfif>
Where uploadfile.cfm contains a typical cffile tag and form.PictureFileName is a text input field with the full path and filename of the file to upload.
The UploadPhoto function submits the form the way I want it to but there seems to be no way to preload the filename into the file input tag.