Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem checking the size of a file

New Here ,
Jul 23, 2013 Jul 23, 2013

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?

223
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources