Solved

CFFILE upload and read!

Posted on 2007-03-20
7
265 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
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 …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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