upload image type validation and resize be fore upload

  • Thread starter Thread starter saqsaqPK
  • Start date Start date
S

saqsaqPK

Guest
kindly advise what changes required :-

1.) only upload . jpeg. jpg, gif, png .pdf file tye.

2.) reduce file size during upload.

below code is working fine but without above two point

if (FileImgesave1.PostedFile != null)
{
string imgfile = Path.GetFileName(FileImgesave1.PostedFile.FileName);

FileImgesave1.SaveAs(path + txtReportNo.Value + "_" + "Report" + "_" + imgfile);

string Report = (@"Images/Misc/Service_Reports/" + txtReportNo.Value + "_" + "Report" +"_"+ imgfile);


SqlConnection connn = new SqlConnection(ConfigurationManager.ConnectionStrings["connection "].ConnectionString);

connn.Open();






com.ExecuteNonQuery();

Response.Redirect(Request.Url.AbsoluteUri);


connn.Close();


}

else

{
lblerer.Text = "Please Select File First";

}

Continue reading...
 
Back
Top