lulu50
asked on
Get the file size
Hi,
I need help.
I need to assign the list to the variable.
I need help.
I need to assign the list to the variable.
//I upload the file first
<cfloop from="1" to="#variables.maxFiles#" index="ii">
<cftry>
<cfif StructKeyExists(form,"AttachFile" & ii) && len(trim(Form["AttachFile" & ii]))>
<CFFILE ACTION="UPLOAD"
FILEFIELD="AttachFile#ii#"
DESTINATION="#variables.filelocation#"
NAMECONFLICT="makeunique">
<cfset Attachments=ListAppend(variables.Attachments,cffile.serverfile)>
//here I get the size of the file in the list
<cfset GetFileSize=ListAppend(variables.GetFileSize,cffile.filesize)>
</cfif>
//here I want to assign them into variable so I can insert the value into the database
<cfloop list="#variables.GetFileSize#" index="fg" delimiters=",">
<cfset variables["filesize" & fg] = #fg#>
</cfloop>
</cfloop>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the main drawback is that you are connecting / disconnecting to the DB on each iteration of the loop.
even if in this case it may be that there is not enough traffic to cause a load problem - still ...
even if in this case it may be that there is not enough traffic to cause a load problem - still ...
I think it's misleading to say you're "connecting" to the database each time as the database connection stays open, but, yes you are accessing the database multiple times. However, based on the time length of a typical cfquery statement, you could conceivably run 50 cfquery statements on a page all within a fraction of a second. I would not be concerned with 3-5 insert statements.
ASKER
Thank you!!!
It works!!!
just what I am looking for.
Thank you again.
It works!!!
just what I am looking for.
Thank you again.
glad i could help ...
like this..
Open in new window