Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Open File Dialog without html file field

Open File Dialog without html file field

Scheduled Pinned Locked Moved ASP.NET
htmlsysadminquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    How can i Open File Dialog without html file field. By clicking on a server button i need to Open File Dialog from server side coding. Thks

    K M 2 Replies Last reply
    0
    • L Lost User

      How can i Open File Dialog without html file field. By clicking on a server button i need to Open File Dialog from server side coding. Thks

      K Offline
      K Offline
      kapil bhatnagar
      wrote on last edited by
      #2

      try using the following code: if (file.Exists) { Response.Clear(); Response.AddHeader("Content-Disposition", "filename=" + file.Name); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/pdf"; Response.WriteFile(file.FullName); Response.Flush(); Response.End(); Response.Close(); } Incase the content type has been defined for word doc or xls file, the file dialog box will open itself. Hope this is of some help !

      L 1 Reply Last reply
      0
      • K kapil bhatnagar

        try using the following code: if (file.Exists) { Response.Clear(); Response.AddHeader("Content-Disposition", "filename=" + file.Name); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/pdf"; Response.WriteFile(file.FullName); Response.Flush(); Response.End(); Response.Close(); } Incase the content type has been defined for word doc or xls file, the file dialog box will open itself. Hope this is of some help !

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        i mean not to open file.. i want to open Open File Dialog box for choosing a file to upload from the local system , without using file field control

        1 Reply Last reply
        0
        • L Lost User

          How can i Open File Dialog without html file field. By clicking on a server button i need to Open File Dialog from server side coding. Thks

          M Offline
          M Offline
          M LN Rao
          wrote on last edited by
          #4

          I hope follwing code is sufficient for you. I open a new page but closes the window and only dialog box appears. onload= function(){ file1= document.getElementById("file1"); file1.click(); window.close(); }

          Intelligence is measured by common sense not by how many scholarly books you read.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups