Skip to main content
Participant
July 23, 2013
Question

Problem checking the size of a file

  • July 23, 2013
  • 0 replies
  • 246 views

Hello ...

I'm having an issue of checking the filesize of files in which the filename are long and have many spaces and commas.

e.g. - If i upload a file with the name - 4008-CS-BBD-FSC-Ceramic-Powders-Resins.pdf then it will accept file and CF will give me the filesize.

However uplading a file with the name - 4008 CS - BBD, FSC, Ceramic Powders & Resins.pdf doesnt give me a filesize (i know the file has been uploaded ok)

The code i'm using to handle this is as follows:

<cfset attachment_filesize = "0">

<cfset attachment_filetype = "">                                    

<cfoutput>

<cfif IsDefined("form.attachment") and form.attachment NEQ "">

<cfset myfile = "#serverPath##form.attachment#">

<cfif FileExists(myfile)>

<cfset FileInfo = GetFileInfo(myfile)>

<cfset attachment_filetype = listLast(myfile,".")>        <!--- Get the File Extension --->

<cfset attachment_filesize = "#FileInfo.Size#">         <!--- Get the File Size --->

</cfif>

</cfif>

</cfoutput>

Can anyone help on how I can resolve this?

This topic has been closed for replies.