Cffile not spawing variable cffile.serverfile containing file name

I’m using a cffile tag to upload an image file from a form. The upload bit works flawlessly, including the rename for uniqueness. However I can’t get the tag to spawn the variable cffile.serverfile as I think it should if the file has to be renamed. I’ve got a cfparam tag in there just to make sure the variable exists so it doesn’t throw an error with my code if the variable doesn’t exist, but every time the variable ends up blank.

What am I doing wrong here please folks? Any clues would be greatly appreciated. Thanks in advance.

                        <cfparam name="form.fileUpload" default="">

                        <cfif len(trim(form.fileUpload))>
                            <cffile action="upload" fileField="fileUpload" destination="C:\path-redacted" allowedExtensions="PNG" nameconflict="makeunique" result="uploadresult">
                            <div class="ui inverted mini uploadimageresult modal">
                                <div class="header">UPLOAD IMAGE</div>
                                <div class="content">                        
                                    <p>Thankyou, image has been uploaded.</p>
                                    <cfparam name=cffile.serverfile default="">
                                    <cfif #cffile.serverfile# is "">
                                        <p>Image File Name:</p>
                                        <p>Image File Name (renamed for uniqueness):</p>
                                <div class="actions">
                                <div class="ui green approve button">OK</div>
                            <script type="text/javascript">

try dumping out the uploadresult variable?

1 Like

Using the variable uploadresult.serverfile did the trick, thanks!