protected void res_ekle_Click(object sender, EventArgs e) { if (FlUpload.HasFile) { try { if (FlUpload != null && (FlUpload.PostedFile.ContentType == "image/gif" || FlUpload.PostedFile.ContentType == "image/png")) { string[] uzanti = FlUpload.FileName.Split('.'); FlUpload.SaveAs(Server.MapPath("img/logo." + uzanti[1])); img_profil.ImageUrl = "img/logo." + uzanti[1]; string yol = "img/logo." + uzanti[1]; } else { ClientScript.RegisterStartupScript(GetType(), "YeniPencere", @"<script language='javascript'>alert('Resim Formatına Dikkat Ediniz.');</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(GetType(), "YeniPencere", @"<script language='javascript'>alert(ex.Message);</script>"); } } }
protected void res_ekle_Click(object sender, EventArgs e) { //if (FlUpload.HasFile) //{ // try // { // if (FlUpload != null && // (FlUpload.PostedFile.ContentType == "image/jpeg" || // FlUpload.PostedFile.ContentType == "image/jpg" || // FlUpload.PostedFile.ContentType == "image/png")) // { // string yol = "profil/p_" + txt_adsoyad.Text.Trim(); // FlUpload.SaveAs(Server.MapPath(yol)); // img_profil.ImageUrl = yol; // } // else // { // ClientScript.RegisterStartupScript(GetType(), "YeniPencere", @"<script language='javascript'>alert('Resim Formatına Dikkat Ediniz.');</script>"); // } // } // catch (Exception ex) // { // ClientScript.RegisterStartupScript(GetType(), "YeniPencere", @"<script language='javascript'>alert(ex.Message);</script>"); // } //} if (FlUpload.HasFile) { try { if (FlUpload != null && (FlUpload.PostedFile.ContentType == "image/jpeg" || FlUpload.PostedFile.ContentType == "image/jpg" || FlUpload.PostedFile.ContentType == "image/png")) { string[] uzanti = FlUpload.FileName.Split('.'); FlUpload.SaveAs(Server.MapPath("profil/" + txt_adsoyad.Text.Replace(" ", "").Trim().ToLower() + "." + uzanti[1])); img_profil.ImageUrl = "profil/" + txt_adsoyad.Text.Replace(" ", "").Trim().ToLower() + "." + uzanti[1]; string yol = "profil/" + txt_adsoyad.Text.Replace(" ", "").Trim().ToLower() + "." + uzanti[1]; } else { ClientScript.RegisterStartupScript(GetType(), "YeniPencere", @"<script language='javascript'>alert('Resim Formatına Dikkat Ediniz.');</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(GetType(), "YeniPencere", @"<script language='javascript'>alert(ex.Message);</script>"); } } }