Question : Allow user to navigate to a folder in windows directory and select the PATH to the file in a .aspx page. Is this possible and how?

Hi

I want to allow the user to navigate to a folder in windows directory and select the PATH to the file in a .aspx page. Is this possible and how?

Thanks

Answer : Allow user to navigate to a folder in windows directory and select the PATH to the file in a .aspx page. Is this possible and how?


This does it.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title></title>

   <script language="javascript" type="text/javascript">

       function getStats(fName) {
           
           var FullFilePath = fName;
           var FilePathComponents = new Array();
           FilePathComponents = FullFilePath.split("\\");
           var FileDirectory = '';
           var ArrayLength = FilePathComponents.length;
           for (var i = 0; i < ArrayLength - 3; i++) {
               FileDirectory += FilePathComponents[i] + "\\";
           }
           FileDirectory += FilePathComponents[ArrayLength - 2] + "\\";

           var txtBx = document.getElementById("txtFilePath");
           txtBx.value = FileDirectory;

       }
       
       

   </script>

</head>
<body>
   <form id="form1" runat="server">
   <table>
       <tr>
           <td>
               <input type="file" name="filediag" style="display: none" onchange="getStats(this.value)" />
               <input type="button" value="browse to file in directory.." onclick="document.form1.filediag.click()" />
           </td>
       </tr>
       <tr>
           <td>
               <asp:TextBox ID="txtFilePath" Width="700px" runat="server"></asp:TextBox>
           </td>
       </tr>
       <tr>
       <td>
           <asp:Button ID="btnSave" runat="server" Text="Save URL"
                onclick="btnSave_Click" />
       </td>
       </tr>
       
       <tr>
       <td>
           <asp:Label ID="lblUrl" runat="server" Text=""></asp:Label>
       </td>
       </tr>
   </table>
   </form>
</body>
</html>


Random Solutions  
 
programming4us programming4us