asp.net上传JPG格式图片失败???
asp.net\u600e\u4e48\u6dfb\u52a0\u80cc\u666f\u56fe\u7247?\u5728\u8bbe\u8ba1\u89c6\u56fe\u5c5e\u6027\u680f\u9009\u62e9style\u5355\u51fb\u540e\u9762\u7684\u7701\u7565\u53f7\u5c31\u4f1a\u5f39\u51fa\u4e00\u4e2a\u5bf9\u8bdd\u6846\uff0c\u5728\u91cc\u9762\u9009\u62e9\u80cc\u666f\u2014\u2014\u80cc\u666f\u56fe\u7247\uff0c\u5355\u51fb\u6d4f\u89c8\u9009\u62e9\u56fe\u7247\u5c31\u53ef\u4ee5\u4e86\u3002
\u8fd9\u91cc\u6709\u4e00\u4e2a\u517c\u5bb9ie/ff\u7684\u56fe\u7247\u4e0a\u4f20\u9884\u89c8\u6548\u679c
\u8bd5\u8bd5\u770b
不知道哦!
绛旓細string fName = picFU.FileName;int i = fName.LastIndexOf(".");//鎵╁睍鍚嶅紑濮.浣嶇疆 string fName1 = fName.Substring(i);//鎵╁睍鍚 if (fName1 != ".jpg" && fName1 != ".gif" && fName1 != ".bmp"){ Response.Write("alert('鍥剧墖鏍煎紡涓嶆纭畘~');");return;} this.pic...
绛旓細<asp:FileUpload id="fuImage" runat="server"/> Code椤 //鎻愪氦鎸夐挳鐨勭偣鍑讳簨浠 protected void btnSubmit_Click(object sender, EventArgs e){ string virpath="my.jpg";//杩欐槸瀛樺埌鏈嶅姟鍣ㄤ笂鐨勮櫄鎷熻矾寰 string mappath=Server.MapPath(virpath);//杞崲鎴愭湇鍔″櫒涓婄殑鐗╃悊璺緞 fuImage.PostedFile.Sav...
绛旓細string fullFileName = this.fudFilePath.PostedFile.FileName;//鏂囦欢璺緞鍚 string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1);//鍥剧墖鍚嶇О string type = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1);//鍥剧墖鏍煎紡 if (type == "jpg" || type =...
绛旓細浠g爜璁捐瀹炵幇鍔熻兘:asp.NET涓婁紶鏂囦欢鍒版寚瀹氭枃浠跺す,ACCESS鏁版嵁搴,SQL鏁版嵁搴撲唬鐮佸凡缁忔祴璇曟枃浠鏍煎紡 .TXT,JPG..MDB.GIF*/using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI...
绛旓細棣栧厛鍒涘缓涓涓獥浣撳彨 login.aspx 鍐嶅垱寤轰竴涓猽pload.aspx 鍦╨ogin.aspx涓啓 绗竴姝,棣栧厛鍦╳eb鎺т欢涓媺杩囧幓涓 image 灏嗗畠鐨刬d鏀逛负img ,鐒跺悗鍐嶄粠涓媺涓涓猙utton 灏嗗叾id鏀逛负btn 鐒跺悗鍙屽嚮button 鍦ㄩ噷闈㈠啓杩欐浠g爜 this.Response.Redirect("upload.aspx");骞跺湪page_load涓啓 this.img.ImageUrl=this....
绛旓細//妫鏌ヤ笂浼犳枃浠剁殑鏍煎紡鏄惁鏈夋晥 if (this.uploadfile.PostedFile.ContentType.ToLower().IndexOf("image") < 0){ Response.Write(" alert('涓婁紶鍥剧墖鏍煎紡鏃犳晥'); ");return;} //鐢熸垚鍘熷浘 Byte[] oFileByte = new byte[this.uploadfile.PostedFile.ContentLength];System.IO.Stream oStream = this...
绛旓細鐩存帴缁欎釜涓婁紶鎸夐挳锛岀敤Jquery鍐$(document).ready(function(){$("#upfile").uploadify({閲岄潰涓婁紶鐨勬枃浠跺す涓'folder':'../../images',鐒跺悗杩樻湁璁剧疆鍥炰紶鍥剧墖onComplete:function(){document.getElementById("img").src="../../images/"+response+".jpg";} 鐢ASP.NET鎬庝箞鍐欐枃浠朵笂浼犲拰涓嬭浇鐨勪唬鐮...
绛旓細asp銆net涓湁涓涓婁紶鍥剧墖鎸夐挳鎺т欢锛屼綘鎷栬繘鍘诲氨鍙互浜嗐俻ublic void CreateMdAndFilePaht(HttpPostedFile hpf){ //string wordMd = Request.PhysicalApplicationPath.Replace(HttpRuntime.AppDomainAppVirtualPath.Replace("/", "") + "\\", "");string upPaht = "upload";string createPaht = "\\...
绛旓細闄ら潪鏀瑰彉鍥剧墖鏍煎紡 璇曡瘯涓嬮潰杩欎釜 /**/ /// /// 鐢熸垚缂╃暐鍥 /// /// 婧愬浘璺緞锛堢墿鐞嗚矾寰勶級 /// 缂╃暐鍥捐矾寰勶紙鐗╃悊璺緞锛 /// 缂╃暐鍥惧搴 /// 缂╃暐鍥鹃珮搴 /// 鐢熸垚缂╃暐鍥剧殑鏂瑰紡 public static void MakeThumbnail(string originalImagePath, string thumbnailPath, int width, int height,...
绛旓細//涓婁紶鏂囦欢 Label2.Text = "姝e湪涓婁紶,璇风瓑寰...";File1.PostedFile.SaveAs(Server.MapPath("Upimage") + "\\" + fileName);//鎶婂熀鏈俊鎭啓杩涙暟鎹簱锛屼繚瀛鍥剧墖鍦ㄦ湇鍔″櫒鐨勮矾 cc="鏂囦欢:"+fileName+"涓婁紶鎴愬姛!";Open();this.Label2.Text=fileName;this.Im2.Visible=true;this.Im1.Visible...