📄 multipartfileupload.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;
using System.Net;
using System.IO;
namespace Org.Carrot2
{
//
// This class based on an example from:
// http://blog.mindbridge.com/?p=59
//
// With modifications.
//
public class MultipartFileUpload
{
private Uri uri = null;
private NameValueCollection parameters = null;
private NameValueCollection formData = null;
private String fileDisplayName = null;
private String fileParameterName = null;
private String boundary;
private FileInfo file = null;
private NetworkCredential networkCredential = null;
private readonly int BUFFER_SIZE = 500;
public MultipartFileUpload()
{
parameters = new NameValueCollection();
formData = new NameValueCollection();
}
public MultipartFileUpload(Uri uri)
: this()
{
this.uri = uri;
}
#region getters and setters
/// <summary>
/// the destination of the multipart file upload
/// </summary>
public Uri Uri
{
get { return this.uri; }
set { this.uri = value; }
}
/// <summary>
/// the parameters to be passed along with the post method
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -