-
大小: 140KB文件类型: .zip金币: 2下载: 0 次发布日期: 2021-05-13
- 语言: 其他
- 标签: webservice 上传下载
资源简介
webservice的上传、下载、获取文件名称数量,完整代码 可直接运行

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
//1先要发布webservice然后部署在iis中 或者将webservice工程单独打开启动
//2在引用中添加服务引用 发布后或者启动的地址
//3如果第2步的引用调用不到webservice的方法 重新引用 在引用右键添加服务引用 不输入地址,左下角点击“高级“弹出的窗体中左下角点击“添加web引用“ 在弹出的窗体中输入webservice的地址即可
//4就可以调用webservice方法了
string path = string.Empty;//返回上传时的完整路径 可截取保存文件名
SaveImg(“222“ out path);
}
///
/// 保存图片
///
/// 服务器文件夹名
/// 全路径
///
public string SaveImg(string MouldName out string path)
{
string fileName = string.Empty;
OpenFileDialog ofd = new OpenFileDialog();//选择文件的窗体
ofd.Filter = “JPG文件|*.jpg|PNG文件|*.png“;//限制文件类型如果不限制注释即可
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
localhost.WebService1 web = new localhost.WebService1();//引用webservice
byte[] fs = File.ReadAllBytes(ofd.FileName);
int index = ofd.FileName.LastIndexOf(“\\“) + 1;
fileName = ofd.FileName.Substring(index);
//pb.Tag = fileName;
path = ofd.FileName;//返回上传时的完整路径
//上传文件
string str = web.UploadFile(““ MouldName fileName fs);//调用webservice的方法
path = ofd.FileName;
if (str != ““)
{
MessageBox.Show(str);
}
}
else
{
path = null;
}
return fileName;
}
private void button2_Click(object sender EventArgs e)
{
OpenImg(“222“ “56ea133427366.jpg“);
}
///
/// 下载文件
///
///
///
public void OpenImg(string MouldName string fileName)
{
localhost.WebService1 web = new localhost.WebService1();//引用webservice
byte[] file = web.DownloadFile(““MouldName fileName);
SaveFileDialog sfd = new SaveFileDialog();
//sfd.Filter = “EXCEL文件(*.xlsx)|*.xlsx“;
List lTemp = new List();
lTemp.AddRange(file);
lTemp.RemoveRange(0 10);
byte[] fileS = new byte[lTemp.Count];
l
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-10-21 17:17 webservice文件上传下载\
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\.vs\
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\.vs\WindowsFormsApplication1\
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\.vs\WindowsFormsApplication1\v14\
文件 5120 2019-10-21 17:16 webservice文件上传下载\demo\WindowsFormsApplication1\.vs\WindowsFormsApplication1\v14\.suo
文件 1046 2019-10-21 16:59 webservice文件上传下载\demo\WindowsFormsApplication1\App.config
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\bin\
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\bin\Debug\
文件 20992 2019-10-21 17:13 webservice文件上传下载\demo\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 1046 2019-10-21 16:59 webservice文件上传下载\demo\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
文件 40448 2019-10-21 17:13 webservice文件上传下载\demo\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 22696 2019-10-21 17:16 webservice文件上传下载\demo\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 1046 2019-10-21 16:59 webservice文件上传下载\demo\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
文件 490 2018-04-12 07:35 webservice文件上传下载\demo\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
文件 4966 2019-10-21 17:13 webservice文件上传下载\demo\WindowsFormsApplication1\Form1.cs
文件 3301 2019-10-21 17:07 webservice文件上传下载\demo\WindowsFormsApplication1\Form1.Designer.cs
文件 5817 2019-10-21 17:07 webservice文件上传下载\demo\WindowsFormsApplication1\Form1.resx
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\obj\
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\
文件 868 2019-10-21 17:15 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 8230 2019-10-21 17:15 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2019-10-21 16:58 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2019-10-21 16:58 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2019-10-21 16:58 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
目录 0 2019-10-21 17:17 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\TempPE\
文件 13312 2019-10-21 17:08 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\TempPE\Web References.localhost.Reference.cs.dll
文件 1563 2019-10-21 17:16 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
文件 1012 2019-10-21 17:13 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
文件 2702 2019-10-21 16:59 webservice文件上传下载\demo\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csprojResolveAssemblyReference.cache
............此处省略74个文件信息
- 上一篇:溴化锂溶液物性参数实用查询软件
- 下一篇:第十届蓝桥杯嵌入式比赛备赛 资料汇总
相关资源
- 通过webservice上传和下载文件
- 基于SSM+CXF构建的RESTFul webservice
- 毕设-云视频学习平台的设计及实现
- springmvc+Mybatis+axis2+webservice+quartz作业整
-
webservice+xm
l新手 - webservice服务上传文件
- eclipse使用axis1.4发布联通vac的webservi
- 基于WebService的航空订票系统
- struts2实现多文件上传
- Idea实现WebService
- BPEL开发详细教程-个人实践
- webservice wsdl文件的生成
- FileZilla_3.33.0_win64-FTP工具
- 通过网页服务器监控设备状态
- webservice+jdbc
- Unity3D访问Webservice返回的数据集并解析
- qt webService Client源码
-
通过webservice提交xm
l数据以及soap协议 - webservice接口测试代码
-
SOAP:xm
l跨平台WebService开发技术.美 - TIPTOP與其他系統之WebService接口資料
- webservice方式系统更新程序
- struts2文件上传
- axis1实现webservice 及客户端调用方法
- TcpMonitor
- mule学习demo包含webservice调用参数转换
- 西北工业大学软件工程WebServices实验报
- 集中式MAS服务平台WebService-短信接口开
- WebApi寄宿到控制台的一个程序
- Building.Microservices
评论
共有 条评论