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

lulu50Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
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?
lulu50Author Commented:
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

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

Did not get the correct solution
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

hieloCommented:
>> "...right now because it will open a quick window than give me the option to either open the file or save as."
>> "...the page tries to open the document than it gives  me the option to open or close. "

>> did I confuse you?
Yes.  The word "than" is not being used correctly.  After you explained again I realized you meant "instead of":
 "...right now because it will open a quick window instead of giving me the option to either open the file or save as."
"...the page tries to open the document instead of giving me the option to open or close. "

As for your problem, try using:
<cfcontent type="application/octet-stream" reset="yes" file="#Path#"  >

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lulu50Author Commented:
hielo,

Sorry me no English :-)

It works thank you for your help.

Thanks,
lulu50Author Commented:
Thanks,
Lulu
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.