[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

parse out image and extension using railo (coldfusion)

Posted on 2010-09-01
8
Medium Priority
?
321 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

656 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