?
Solved

parse out image and extension using railo (coldfusion)

Posted on 2010-09-01
8
Medium Priority
?
320 Views
Last Modified: 2013-12-24
I'm using type="file" in the form, but when i submit the form, the page that follows I get this..

/var/www/domain/public_html/WEB-INF/railo/temp/tmp-20

using..

<cfset thisimage = listfirst(#form.imagefile#,".")>

<cfoutput>#thisimage#</cfoutput>

how would I parse out the name of the file and its extension?
0
Comment
Question by:COwebmaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 33583675
Again, just a guess ... but I'd imagine Railo is like the Adobe version.  All files are uploaded to a temp server directory first and given a temporary file name.  That's what you're seeing when you look at #form.imagefile#.  

You then have to use cffile "upload" to get access to the real file name (and move it to desired directory). Use CFFILE variables like #CFFILE.serverFile#, #CFFILE.serverDirectory# to access the file name and extension ...

ie <cffile action="upload" filefield="form.imagefile" .....>
<cfdump var="#CFFILE#">
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33583757
To clarify the last comment.  First upload.

      <cffile action="upload" filefield="form.imagefile" .....>
 
Then use the cffile variables:

    #CFFILE.serverFileExt#
    Extension of the uploaded file on the server (without a period)

   #CFFILE.serverFileName#
   Name of the uploaded file on the server (without an extension)


0
 
LVL 13

Expert Comment

by:ansudhindra
ID: 33584898
You can use

#cffile.serverfile#

you will get complete file name along with its extension.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 52

Expert Comment

by:_agx_
ID: 33584952
They want the name and extension separated.  Fortunately, cffile has variables for that too ;-) See my previous post.
0
 
LVL 13

Expert Comment

by:ansudhindra
ID: 33587865
Hi, if you want the original file name (name of the file, as you select before uploading), you can use

#cffile.clientfile# ==> complete file name with extension
#cffile.clientfileName# ==> File name (as it was in your system before uploading) without extension
#cffile.clientfileExt# ==> file extension
0
 

Author Comment

by:COwebmaster
ID: 33588609
ok, I'll try out your suggestions.
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 33589210
Personally, I've never found use for client variables.  99% of the time what you're looking for is information about files on your *server*.  That can only be obtained from the *server* variables I mentioned earlier:

    #CFFILE.serverFileExt#
   #CFFILE.serverFileName#

Based on the original question,  you almost certainly should NOT be using the client variables.


0
 

Author Closing Comment

by:COwebmaster
ID: 33592823
Thanks!
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
What You Need to Know when Searching for a Webhost Provider
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question