如何从 WCF 休息服务中的流上传图像 [英] How to upload the image from the stream in WCF rest service

查看:46
本文介绍了如何从 WCF 休息服务中的流上传图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建 wcf 服务,该服务将上传 pdf、doc、xls、图像等文件,但 pdf、txt 文件正在正确上传和打开,但是当我尝试上传图像文件时,该文件为正在上传但图片不可见

I'm trying to create the wcf service which will upload the files like pdf,doc,xls,images but pdf, txt files are uploading and opening properly but when i'm trying to upload the image file then the file is getting uploaded but the image is not visible

  [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "Upload/{fileName}")]
        string Upload(string fileName, Stream fileContents);


using (FileStream fs = new FileStream("my path", FileMode.Create))
            {
                fileContents.CopyTo(fs);
                fileContents.Close();
            }

推荐答案

@mohammad 检查下面的图片我是如何尝试上传图片文件的我尝试上传图像文件的方式

@mohammad check the below image how i'm trying to upload the image file how i'm trying to upload the image file

谢谢

这篇关于如何从 WCF 休息服务中的流上传图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆