Solved

Extracting Uploaded Filename in ColdFusion

Posted on 2014-02-10
2
657 Views
Last Modified: 2014-02-10
Upload 1Upload 2
I am uploading a photo file from my C drive to the ISP webserver and like to know how to extract the file name after it is uploaded. As seen in the screenshots, I can capture the data (entered in Upload_photo1.cfm) in Upload_photo2.cfm except the photo file name.
I tried to display the contents of "file_path", but that resulted in "C:\ColdFusion10\cfusion\runtime\work\Catalina\localhost\tmp\neotmp4276945136024192972.tmp "

Upload_photo1.CFM
--------------------------------------------------
          <CFform action="upload_photo2.cfm" method="POST" name="frmupload" enctype="multipart/form-data">
            <CFINPUT type="file" name="file_path">
--------------------------------------------------

Upload_photo2.CFM
--------------------------------------------------
            <cfif isdefined("form.submit_upload")>
                  <cffile action="UPLOAD" filefield="file_path" destination="D:\home\ABC.com\wwwroot\imageupload\single" nameconflict="MAKEUNIQUE">
                        <font color=blue><h3>File Uploaded Successfully!</h3></font>
            </cfif>
--------------------------------------------------
0
Comment
Question by:sglee
[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
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 320 total points
ID: 39847681
but that resulted in "C:\ColdFusion10\cfusion\runtime\work\Catalina\localhost\tmp\neotmp4276945136024192972.tmp "

When CF receives the upload it stores it in a temp file. That's what you're seeing.

After you use <cffile action="upload" ...>, CF populates the CFFILE structure with info about the uploaded file. To get the saved file name ie "jellyFish.jpg", use:

*Note: Because you're using "makeUnique" it may be slightly different, like "jellyFish (2).jpg"....

      <cffile action="UPLOAD" ....>
      <cfoutput>saved file name : #CFFILE.serverFile#</cfoutput>

To see all variables available
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-738f.html
0
 

Author Comment

by:sglee
ID: 39847742
File Upload - File NameThat worked. Thank you.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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