Solved

CFFILE upload and read!

Posted on 2007-03-20
7
267 Views
Last Modified: 2012-06-27
Hi,

I need users to upload a file from the desktop and want them to store it in this folder "c:\CFprojects\Docs\". After that, if there is a document in this folder, I need that to be linked in the page.

Please help me out.

Thanks in advance.
0
Comment
Question by:sharon212
  • 4
  • 3
7 Comments
 
LVL 36

Expert Comment

by:SidFishes
ID: 18758735


<cfset varTmp = form.doc>


<cffile action="UPLOAD"
        filefield="form.doc"
        destination="c:\CFprojects\Docs\"
        nameconflict="MAKEUNIQUE"
        accept="*.*">

Upload Results
<cfoutput>
<cfif fileexists("c:\CFprojects\Docs\#form.doc#")>
#form.doc#
</cfif>
</cfoutput>

or on a page other than the upload page

<cfdirectory action="list" directory="c:\CFprojects\Docs\" name="myDir">

<cfoutput query = "MyDir">
<a href="http://relativepathto/cfprojects/docs/#myDir.name#">#myDir.name#</a>
</cfouput>





0
 

Author Comment

by:sharon212
ID: 18758862
Hey thanks.

I could upload my files.

But I am not able to link that file in my web page.

0
 

Author Comment

by:sharon212
ID: 18759099
Hi, I could get the links too.. but it is not opening.  When I click the link, it says "the page cannot be found"
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 18759166
can you post your code
0
 

Author Comment

by:sharon212
ID: 18759237

    <tr>
      <td class = "tdhdr-v"> Upload </td>
      <td class = "tdhdr1"> <input type = "file" name = "Nprtfile" size = "20" >
                        <input type="submit" name="fileUpload" value="Go!" />
      </td>
    </tr>

<cffile action = "upload"  
      fileField = "Nprtfile"  
      destination = "c:\CFProjects\DevAG\temp\"
      accept = "image/jpg, application/ms-excel, application/msword, application/pdf">

<cfdirectory action="list" directory="c:\CFprojects\DevAG\Temp\" name="Dirfil">

</cfoutput>

<cfoutput query = "Dirfil">
<tr>
<a href="http://mypath/cfprojects/DevAG/#Dirfil.name#">#Dirfil.name#</a>
</tr>
</cfoutput>

And also I am not able to upload ms-excel files.
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 18759919


try adding

<cfoutput query = "Dirfil">
<tr>
<a href="http://mypath/cfprojects/DevAG/#Dirfil.name#.DOC">#Dirfil.name#</a>
</tr>
</cfoutput>

 If that works we'll be needing some extension handling...
0
 

Author Comment

by:sharon212
ID: 18774464
Thank you very much for your help. What I did was, just I made it mypath under the webserver (inet). that's all. It works great.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 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