cfFile upload and Rename

View: New views
2 Messages — Rating Filter:   Alert me  

cfFile upload and Rename

by Adam Parker-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


When attempting to upload multiple files, I encounter an error after the first file is uploaded.

The error states:

 Element NOMINATION is undefined in CFFILE.
 
453 :
454 : <!---File that was just uploaded--->
455 : <cfset nomination = #cffile.nomination#>
456 : <!---Rename the uploaded file, give it the existing file's original name--->
457 : <cfset renameuploaded = "nomination.#cffile.ClientFileExt#">


The code for the start of the uploads is:

<cfset destination = expandPath("./nominationUploads
/#fname#_#lname#/")>

<!---If the destination directory does not exist, create it.  This will be unique for each nominee.--->
<cfif not directoryExists(destination)>
        <cfdirectory action="create" directory="#destination#">
</cfif>

        <!---Upload nomination document to the destination.  Accpet only MSWord, PDF, RTF and plain text files.--->
        <cffile action="upload"
                filefield="nominationLetter"
                destination="#destination#"
                nameconflict="makeUnique"
                result="upload"
                accept="application/msword, application/pdf, application/rtf, text/plain">

                <!---File that was just uploaded--->
                <cfset nomination = #cffile.nomination#>
                <!---Rename the uploaded file, give it the existing file's original name--->
                <cfset renameuploaded = "nomination.#cffile.ClientFileExt#">
                                               


I am attempting to take the first document (nominationLetter) and upload it to a directory named after each nominee.  After the file is uploaded, I want to rename it to, in this case, "nomination" and retain the same file extension with which the document was uploaded.

A second set of eyes would be helpful.

Thanks,
Adam

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4851
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

Re: cfFile upload and Rename

by Adam Parker-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've changed the variable:

<!---File that was just uploaded--->
455 : <cfset nomination = #cffile.clientFile#>
456 : <!---Rename the uploaded file, give it the existing file's original name--->
457 : <cfset renameuploaded = "nomination.#cffile.ClientFileExt#">


to #cffile.clientFile# and the process stills does not find the variable.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4852
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15