Solved

Extracting Uploaded Filename in ColdFusion

Posted on 2014-02-10
2
673 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

635 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