Open Dialog box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krithikav
    New Member
    • Sep 2007
    • 7

    Open Dialog box

    I have an excel file created by a program on the server. On click of "Download" button, I would like the traditional "Open/Save" dialog box to pop-up so that the users can save in the client machine. Is it possible in asp??? if so, pls. help me with a snippet.

    thanks in advance.

    Krithika
  • CroCrew
    Recognized Expert Contributor
    • Jan 2008
    • 564

    #2
    Hello krithikav,

    Are you creating the Excel file via an ASP page? Or is the file on the server and you wanted to link to it and have someone download it?

    Cro~

    Comment

    • markrawlingson
      Recognized Expert Contributor
      • Aug 2007
      • 346

      #3
      This is a local switch on the person's computer and will rely completely on the local settings on the person's computer who clicks the button. There's nothing you can do to influence it server side.

      For instance, on my computer it will prompt me with an open/save dialogue box. On my boss's computer, it will not prompt him to save the file, but rather the file opens directly in internet explorer.

      Sincerely,
      Mark

      Comment

      • krithikav
        New Member
        • Sep 2007
        • 7

        #4
        Originally posted by CroCrew
        Hello krithikav,

        Are you creating the Excel file via an ASP page? Or is the file on the server and you wanted to link to it and have someone download it?

        Cro~
        The excel file is created by an asp page on the server. Later if the user wants to download it to local disk, this download button should be provided.

        Comment

        • nedu
          New Member
          • Nov 2006
          • 65

          #5
          Hi ,

          U can use the following code . .

          ClickMe.asp
          <HTML>
          <BODY>
          <a href="download. asp?fname=1.xls ">Click hereto Download</a>
          </BODY>
          </HTML>

          Download.ASP

          on error resume next
          Response.Conten tType = "applicatio n/x-unknown" ' arbitrary
          fname = Request.QuerySt ring("fname")
          fn = fname
          FPath = Server.MapPath( fn) '& "\" & fn
          'Response.Write FPath
          'Response.End
          Response.AddHea der "Content-Disposition","a ttachment; filename=" & fn
          Set adoStream = CreateObject("A DODB.Stream")
          adoStream.Open( )
          adoStream.Type = 1
          adoStream.LoadF romFile(FPath)
          Response.Binary Write adoStream.Read( )
          adoStream.Close
          Set adoStream = Nothing
          Response.End


          Please try and let me know u r queries. . .

          Comment

          Working...