coolidge wrote:
> Hello - I have a CF form that allows users to upload two
files, a document and
> a photo:
>
> Upload document: <INPUT NAME="upFileName" SIZE="30"
TYPE="FILE">
> Upload photograph: <INPUT NAME="upPhotoName"
SIZE="30" TYPE="FILE">
>
> I need to store both the name of the document and the
name of the photo in an
> MS SQL database. However, if I insert to the database
using the
> #File.ServerFile# variable, only one of the file names
is stored, of course.
> What is the best way to have two different variables
representing the two
> different files? Thanks!!
The file structure contains the data of the *last* <cffile
action="upload"...> call. So you can either use this by
doing one
<cffile...> update your database with that data, then
do the next
<cffile...>.
Since CF7, the <cffile...> tag has the 'result'
paramater that allows
you to name a different variable to contain the results of a
<cffile
action="upload"...> operation. So you can use this to give
the two
upload actions different variable names and then use those in
your
database update transactions.
<cffile action="upload" result="documentFile"...>
<cffile action="upload" result="photoFile"...>
<cfoutput>
#documentFile.ServerFile#
#photoFile.ServerFile#
</cfoutput>