I want to get FileUpload path that selected by user

Last post 05-01-2008 9:05 PM by winzone. 2 replies.

Sort Posts:

  • I want to get FileUpload path that selected by user

    04-30-2008, 1:03 AM
    • Loading...
    • winzone
    • Joined on 01-18-2006, 11:44 PM
    • Sg
    • Posts 31

                    string strConn;
                    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                   

                    "Data Source=C:\\abc.xls;" +
                   

                    " Extended Properties=Excel 8.0;";             
                    OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);

                    DataSet myDataSet = new DataSet();
                    myCommand.Fill(myDataSet, "ExcelInfo");

                    DataGrid1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView;
                    DataGrid1.DataBind();
                   

    My Data Source file path is fixed. So, i want to define Excel file path in Data Source from asp:FileUpload selected path.

    how can i do it in asp.net 2005. I can only get Excel file name.

    WinZone
  • Re: I want to get FileUpload path that selected by user

    04-30-2008, 7:52 AM
    Answer
    • Loading...
    • SGWellens
    • Joined on 01-02-2007, 4:27 PM
    • MN, USA
    • Posts 2,748
    • Moderator
      TrustedFriends-MVPs

    winzone:
    I can only get Excel file name.

    You need to call FileUpload1.SaveAs(...) to save the file to the server.  If you have multiple simultaneous users, you will need to make sure the files do not overwrite each other.

    The path the user has selected to upload the file is not useful....the server does not have access to the user's directory.

    Steve Wellens
  • Re: I want to get FileUpload path that selected by user

    05-01-2008, 9:05 PM
    • Loading...
    • winzone
    • Joined on 01-18-2006, 11:44 PM
    • Sg
    • Posts 31

     Thank SGWellens ...Big Smile

    WinZone
Page 1 of 1 (3 items)