Copy link to clipboard
Copied
I need to manipulate files after upload. They are all uploaded in 1 directory by a flash component and then i need to rename them and move them to the directory that corresponds with choosen categories and subcategories. Now I am having problems with finding out how to get my variables correctly
It is about the variable thisFiletoMove1, it should correspond with the destination file in the cffile tag
<cfif FileExists('#request.site.imgupload#\max_#MultiPowUploadFileName_0#')>
<cffile action="rename"
source="#request.site.imgupload#\max_#MultiPowUploadFileName_0#"
destination="#request.site.imgupload#\#request.currentimgid#_max.jpg">
<cfset thisFiletoMove1 = #request.currentimgid#_max.jpg />
</cfif>
<cfset thisFiletoMove1 = #request.currentimgid#_max.jpg /> is giving an error Invalid CFML construct found, ColdFusion was looking at the following text:
_max.jpg
Then I try
<cfset thisFiletoMove1 = #request.currentimgid & "_max.jpg" /> and I get
So now I am wondering, what is the correct way to do this??
Bianca
...
bianca_homedev wrote:
I need to manipulate files after upload. They are all uploaded in 1 directory by a flash component and then i need to rename them and move them to the directory that corresponds with choosen categories and subcategories. Now I am having problems with finding out how to get my variables correctly
It is about the variable thisFiletoMove1, it should correspond with the destination file in the cffile tag
<cfif FileExists('#request.site.imgupload#\max_#MultiPowUploadFileName_0#') >
Copy link to clipboard
Copied
Array notation is your friend.
ThisFileToMove = request[currentimgid & "_max.jpg"]
Copy link to clipboard
Copied
Dan Bracuk wrote:
Array notation is your friend.
ThisFileToMove = request[currentimgid & "_max.jpg"]
Right in spirit of course. The request variable is apparently currentimgid, and so this should have read
ThisFileToMove = request[currentimgid] & "_img.jpg"
However, I think Bianca's problem occurs else where.
Copy link to clipboard
Copied
bianca_homedev wrote:
I need to manipulate files after upload. They are all uploaded in 1 directory by a flash component and then i need to rename them and move them to the directory that corresponds with choosen categories and subcategories. Now I am having problems with finding out how to get my variables correctly
It is about the variable thisFiletoMove1, it should correspond with the destination file in the cffile tag
<cfif FileExists('#request.site.imgupload#\max_#MultiPowUploadFileName_0#') >
<cffile action="rename"
source="#request.site.imgupload#\max_#MultiPowUploadFileName_0#"
destination="#request.site.imgupload#\#request.currentimgid#_max.jpg" >
<cfset thisFiletoMove1 = #request.currentimgid#_max.jpg />
</cfif><cfset thisFiletoMove1 = #request.currentimgid#_max.jpg /> is giving an error Invalid CFML construct found, ColdFusion was looking at the following text:
_max.jpg
Then I try
<cfset thisFiletoMove1 = #request.currentimgid & "_max.jpg" /> and I get
The source C:\websites\beta.antiek.net\demo\galleries\test\thisFiletoMove1 specified in the cffile tag is invalid
So now I am wondering, what is the correct way to do this??
These are both wrong:
<cfset thisFiletoMove1 = #request.currentimgid#_max.jpg />
<cfset thisFiletoMove1 = #request.currentimgid & "_max.jpg" />
You were almost there. What you intended saying was probably
<cfset thisFiletoMove1 = "#request.currentimgid#_max.jpg" />
<cfset thisFiletoMove1 = #request.currentimgid# & "_max.jpg" />
However, even better are
<cfset thisFiletoMove1 = request.currentimgid & "_max.jpg" />
<cfset thisFiletoMove1 = request[currentimgid] & "_max.jpg" />