Open File Dialog without html file field
-
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
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 !
-
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 !
-
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
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.