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...

Recommended Answers

All 2 Replies

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";
            }


        }
    }

thank i got it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.