Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE -> extension?

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

I'm writing an updater where a user can upload a file like: jpg/gif/avi.

Now, that's working fine, the only problem is that I need to rename the file, before uploading it.
So: a user selects a file on his computer called 'jamesbond.jpg' on page1.cfm and on page2.cfm I want to rename the file first to e.g. 007.jpg instead of uploading it as 'jamesbond.jpg'.

The problem is not how to rename it, but how can I determine the fileextension?
I do not want to rename a JPG file as a GIF file, so the script needs to know the source file is a JPG OR a GIF file.


Many thanks in advance!

Brma

 
You should be able to look at the string and make a decision based on it. Like:

<cfswitch expression=#Right(variable)#>
<cfcase value=&quot;jpg&quot;>
<do some work here for a JPG>
</cfcase>

<cfcase value=&quot;gif&quot;>
<do some work for a GIF>
</cfcase>
</cfswitch>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top