Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Extracting Uploaded Filename in ColdFusion

Posted on 2014-02-10
2
Medium Priority
?
699 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 1280 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

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

730 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