0

hello i want to file attach only specific format and restrict size on file and also remove file option. how its possible.?
i used uploadfile control of asp.net but remove file option and size of file not there..
kindly tell me how can do this.
advance thanks...

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by mani508
1

There is no option like fileopendialog control to restrict the user to select specified format of file.

but you can do it like

I used on fileupload, button and label control for zip formate and file size less than 4 MB

 protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile == true)
        {
            if (FileUpload1.FileName.Contains(".zip") == true)
            {
                if (FileUpload1.PostedFile.ContentLength / 1048576 <= 4)
                {
                    FileUpload1.SaveAs(Server.MapPath("~/" + FileUpload1.FileName));
                    Label1.Text = "";
                }
                else
                {
                    Label1.Text = "File size can't exceed 4 MB";
                }
                Label1.Text = "";
            }
            else
            {
                Label1.Text = "File Must be in Zip format";
            }


        }
    }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.