亲,您提交的图片不下列属于原始凭证的有图片,请上传原始图

亲您提交的图片不属于原始图片_百度知道
亲您提交的图片不属于原始图片
/zhidao/pic/item/3bf33a87e38cfb5643fbf2b3118bd7.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><a href="http.jpg" esrc="http://g.com/zhidao/wh%3D450%2C600/sign=631bca8db6a1b6e468e089/3bf33a87e38cfb5643fbf2b3118bd7<a href="http
您的回答被采纳后将获得:
系统奖励20(财富值+经验值)+难题奖励10(财富值+经验值)+提问者悬赏5(财富值+经验值)其他回答(13)
文件上传有两个基本参数:源路径和目标路径,客户端获取从服务端返回的目标路径
客户端把图片用切分 然后用TCP通信传递到指定服务端,服务端接收数据 保存文件
既然是cs通讯,有两种选择:
1.你可以把图片存入数据库的某个字段中,而不存是文件名,直接存比特流(byte[])。
2.将图片存入文件系统,然后把路径写入数据库中。
接收和发送,你直接发送比特流就可以了呀!二进制传输,针对任何类型的文件都是一样的。
tcp传文件字节数组就好了
园豆:3629
建议看看这个http://www.tracefact.net/CSharp-Programming/Network-Programming-Part5.aspx
是客户端通过网页上传吗?
园豆:41213
园豆:41213
园豆:41213
园豆:41213
园豆:41213
园豆:41213
客户端是如何传送?
[HttpPost]
public ActionResult Index(HttpPostedFileBase pic)
string fileFormat = Path.GetExtension(pic.FileName);
string fileName = Guid.NewGuid().ToString("N");
string imageSaveDirectory = Server.MapPath("~/Upload");
if (!Directory.Exists(imageSaveDirectory))
Directory.CreateDirectory(imageSaveDirectory);
bool result = false;
string imageSavePath = bine(imageSaveDirectory, fileName + fileFormat);
pic.SaveAs(imageSavePath);
if (System.IO.File.Exists(imageSavePath))
result = true;
//上传成功
if (result)
return Json(new { result = "1", msg = "OK" });
//上传失败
return Json(new { result = "0", msg = "Fail"});
我项目中的一些代码,也许有帮助。[HttpPost]
public ActionResult LEdit(Shop_MemberLevel _shop_MemberLevel, HttpPostedFileBase ImgPath)
_shopMemeber.UpdateLevel(_shop_MemberLevel, ImgPath);
return SuccessMsg("AdminMemberMemberLevel");
public void UpdateLevel(Shop_MemberLevel shopMemeberLevel, HttpPostedFileBase logoFile)
shopMemeberLevel.ImgPath = SaveImages(logoFile, new int[][] { new int[] { 100, 30 }, new int[] { 200, 10 }, }, "W",
"Download\\Level");
_unitOfWork.Shop_MemberLevelRepository().Update(shopMemeberLevel);
_unitOfWork.Save();
/// &summary&
/// 保存图片以及生产缩略图
/// &/summary&
/// &param name="imageFileBase"&图片流&/param&
/// &param name="imageName"&保存的图片名&/param&
/// &param name="sizes"&缩略图大小,sizes为形如[ [width1,height1], [width2,height2] ]的数组&/param&
/// &param name="mode"&生成缩略的模式,HW-拉伸,W-指定宽度,H-指定高度,Cut-剪裁&/param&
/// &param name="directory"&目录,前后无斜杠&/param&
/// &returns&保存的文件夹路径&/returns&
public string SaveImages(HttpPostedFileBase imageFileBase, int[][] sizes, string mode, string directory = "")
//检查并创建目录
string path = HttpContext.Current.Server.MapPath("/");
string virtulpath = "";
if (!string.IsNullOrEmpty(directory))
virtulpath += directory + "\\";
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
//创建GUID
var guid = Guid.NewGuid();
//保存原图
imageFileBase.SaveAs(path + guid + ".jpg");
/*生成缩略图
* sizes为形如
* [ [width, height],[width2, height2]]
*的二维数组
foreach (int[] size in sizes)
if (size.Count() != 2)
int width = size[0];
int height = size[1];
string thumPath = path + guid + "_" + width + "x" +
height + ".jpg";
MakeThumNail(path + guid + ".jpg", thumPath, width, height, mode);
return "\\" + virtulpath + guid + ".jpg";
/// &summary&
/// 生成缩略图
/// &/summary&
/// &param name="orginalImagePat"&原图片地址&/param&
/// &param name="thumNailPath"&缩略图地址&/param&
/// &param name="width"&缩略图宽度&/param&
/// &param name="height"&缩略图高度&/param&
/// &param name="model"&生成缩略的模式,HW-拉伸,W-指定宽度,H-指定高度,Cut-剪裁&/param&
public void MakeThumNail(string originalImagePath, string thumNailPath, int width, int height, string model)
//originalImagePath = MapPath(originalImagePath);
//thumNailPath = HttpContext.Current.Server.MapPath(thumNailPath);
System.Drawing.Image originalImage = System.Drawing.Image.FromFile(originalImagePath);
int thumWidth =
//缩略图的宽度
int thumHeight =
//缩略图的高度
int x = 0;
int y = 0;
int originalWidth = originalImage.W
//原始图片的宽度
int originalHeight = originalImage.H
//原始图片的高度
switch (model)
case "HW":
//指定高宽缩放,可能变形
//指定宽度,高度按照比例缩放
thumHeight = originalImage.Height * width / originalImage.W
//指定高度,宽度按照等比例缩放
thumWidth = originalImage.Width * height / originalImage.H
case "Cut":
if ((double)originalImage.Width / (double)originalImage.Height & (double)thumWidth / (double)thumHeight)
originalHeight = originalImage.H
originalWidth = originalImage.Height * thumWidth / thumH
x = (originalImage.Width - originalWidth) / 2;
originalWidth = originalImage.W
originalHeight = originalWidth * height / thumW
y = (originalImage.Height - originalHeight) / 2;
//新建一个bmp图片
System.Drawing.Image bitmap = new System.Drawing.Bitmap(thumWidth, thumHeight);
//新建一个画板
System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(bitmap);
//设置高质量查值法
graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.H
//设置高质量,低速度呈现平滑程度
graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQ
//清空画布并以透明背景色填充
graphic.Clear(System.Drawing.Color.Transparent);
//在指定位置并且按指定大小绘制原图片的指定部分
graphic.DrawImage(originalImage, new System.Drawing.Rectangle(0, 0, thumWidth, thumHeight), new System.Drawing.Rectangle(x, y, originalWidth, originalHeight), System.Drawing.GraphicsUnit.Pixel);
bitmap.Save(thumNailPath, System.Drawing.Imaging.ImageFormat.Jpeg);
catch (Exception ex)
originalImage.Dispose();
bitmap.Dispose();
graphic.Dispose();
就是在那的Request.Files里面
园豆:1233
你发的不是文件流啊????。。。。。。。。
对头,Request.Files;
&HttpFileCollection uploadedFiles = Request.F&&&&&&& for (int i = 0; i & uploadedFiles.C i++)&&&&&&& {&&&&&&&&&&& HttpPostedFile F = uploadedFiles[i];&&&&&&&&&&& if (uploadedFiles[i] != null && F.ContentLength & 0)&&&&&&&&&&& {&&&&&&&&&&&&&&& //得到上传文件的长度&&&&&&&&&&&&&&& int upFileLength = F.ContentL&&&&&&&&&&&&&&& //Loger.Debug("upFileLength==&" + upFileLength);&&&&&&&&&&&&&&& //得到上传文件的客户端MIME类型&&&&&&&&&&&&&&& string contentType = F.ContentT&&&&&&&&&&&&&&& byte[] FileArray = new Byte[upFileLength];&&&&&&&&&&&&&&& Stream fileStream = F.InputS&&&&&&&&&&&&&&& fileStream.Read(FileArray, 0, upFileLength);&&&&&&&&&&&&&&& string newName = F.FileName.Substring(F.FileName.LastIndexOf("\\") + 1);&&&&&&&&&&&&&&& string id = newName.Substring(0, newName.LastIndexOf("."));&&&&&&&&&&&&&&& string pathUrl = "c:/fileroot/" + newN //服务器本地路径&&&&&&&&&&&&&&& F.SaveAs(pathUrl);&&&&&&&&&&& }&&&&&&& }
大概就是这样子....
你好,安卓那边传图,服务器接受。可以用base64 去做。我想问下楼主直接用流 成功了吗。可以交流下qq
&&&您需要以后才能回答,未注册用户请先。太阳最红,毛**最亲原始图片 - 街拍实拍视频 - 爱拍原创

我要回帖

更多关于 下列属于原始凭证的有 的文章

 

随机推荐