Creating a Directory for upload image on SQL2000 SERVER

Discussion in 'ASP.NET 2.0' started by bigmike40, Jun 1, 2007.

  1. How do i create a Directory to store upload image on SQL 2000 SERVER.so when a user hit upolad the image save in the folder/dir on the server
    Thanks
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. Imeant on the webserver this the code that i would like to use and i wanted create the dir



    protected void Button2_Click(object sender, EventArgs e)


    {


    int sessionCount = Session.Count;





    for (int i = sessionCount - 1; i >= 0; i--)


    {


    if (sessionCount <= 3)


    {


    HtmlInputFile hif = (HtmlInputFile)Session["myupload" + i];


    if (hif.PostedFile.ContentLength <= 500000)


    {


    string storePath = Server.MapPath("~") + "/MultipleUpload";


    if (!Directory.Exists(storePath))


    Directory.CreateDirectory(storePath);


    hif.PostedFile.SaveAs(storePath + "/MultipleUpload" + Path.GetFileName


    (hif.PostedFile.FileName));


    Label1.Text = "Your Files are uploaded successfully";


    ListBox1.Items.Clear();


    }


    else


    Label1.Text = "An error occured";


    }


    else


    Label1.Text =


    "You have exceeded the maximum number of files to be uploaded (3)";





    }


    Session.RemoveAll();


    }
     
  4. Bruce

    Bruce DiscountASP.NET Staff

  5. Thank you, it works
     

Share This Page