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

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

问题描述

我正在尝试创建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 Rest服务中从流中上传图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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