Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Problem checking the size of a file

$
0
0

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?


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>