if (UploadUserPhoto.PostedFile != null)
{
string myMap = MapPath("~/").ToLower();
Random r = new Random();
int next = r.Next();
string ImageName = UploadUserPhoto.PostedFile.FileName;
extension = ImageName.Substring(ImageName.LastIndexOf(".")).ToLower();
if (extension == ".gif" || extension == ".png" || extension == ".jpg" || extension== ".jpeg" || extension == ".bmp")
{
string ImageSaveURL = myMap + "UserImage/" + next + extension;
try
{
UploadUserPhoto.PostedFile.SaveAs(ImageSaveURL);
string RegisterQuery = "INSERT INTO [ImageUpload] (Email,Password,Name,Country,Description,ImageName) VALUES('" + TextBoxEmail.Text + "','" + TextBoxPassword.Text + "','" + TextBoxName.Text + "','" + TextBoxCountry.Text + "','" + TextBoxComment.Text + "','" + next + extension + "')";
dbClass.ConnectDataBaseToInsert(RegisterQuery);
Response.Redirect("~/login.aspx");
}
catch (Exception ex)
{
throw ex;
}
}
else
{
}