Link to home
Start Free TrialLog in
Avatar of lulu50
lulu50Flag for United States of America

asked on

View Uploaded file from a folder

Hi,

I have an uploaded file that is stored in a folder.

I want when the user click on the link it will give the user an option to either open the file or save as

something is not correct right now because it will open a quick window than give me the option to either open the file or save as

this is my code:

<cfif (isDefined("url.ICD") and #url.ICD# neq "")>
    <tr>
    <td align="right" valign="top" style="width:10%;padding-right:5px;"><span style="color:#4a79a5;font-weight:normal;">View/Download uploaded files:</span></td>
    <td valign="top" colspan="6">                   
    <table style="width:50%;">
    <CFIF (isdefined('FilesList') and #FilesList.RecordCount# gt 0)>
	<cfoutput query="FilesList">
    	<tr>
        	<td style="width:20%;" >
            <span onClick="window.open('ViewUploadedFiles.cfm?FileID=#FilesList.FileID#',640,480); ">#FilesList.path#</span>
             <hr />
            </td>
            <td style="width:10%;" >
            <img src="images/Delete_Icon.jpg" alt="Delete file" style="width:15px;height:15px;cursor:pointer;"
   onclick="" />
            </td>
            <td>
            <img src="images/View_Icon.jpg" alt="View/Open file" style="width:15px;height:15px;cursor:pointer;"
    onClick="window.open('ViewUploadedFiles.cfm?FileID=#FilesList.FileID#',640,480); " />
            </td>
        </tr>
      </cfoutput>
      </CFIF>
     </cfif>


// this is file:   ViewUploadedFiles.cfm

<cfif (isDefined("url.FileID") and #url.FileID# neq "")> 

<cfquery name="FilesList" datasource="#strDSN#" username="#strUID#" password="#strPWD#">
select * from TestingUploadFile
where FileID = #FileID#
</cfquery>


<cfset Path=#expandpath('./UploadedFiles/#FilesList.path#')#>

<cfheader name="Content-Disposition" value="attachment; filename=#FilesList.path#" />

<cfcontent type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" reset="yes" file="#Path#"  > 
 

</cfif>

Open in new window

Avatar of hielo
hielo
Flag of Wallis and Futuna image

I want when the user ... to either open the file or save as
something is not correct right now because it...give me the option to either open the file or save as
Ok, so problem solved, no?
Avatar of lulu50

ASKER

Hielo,

did I confuse you?


In this code below, the page tries to open the document than it gives me the option to open or close.
I there a way not to let it open the document, I just want it to go straight to give me the option to open or close.

Is there a different way to do the code below?

<cfset Path=#expandpath('./UploadedFiles/#FilesList.path#')#>

<cfheader name="Content-Disposition" value="attachment; filename=#FilesList.path#" />

<cfcontent type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" reset="yes" file="#Path#"  > 
 

Open in new window

Avatar of lulu50

ASKER

I've requested that this question be deleted for the following reason:

Did not get the correct solution
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lulu50

ASKER

hielo,

Sorry me no English :-)

It works thank you for your help.

Thanks,
Avatar of lulu50

ASKER

Thanks,
Lulu