【实例简介】
文件上传到pdf
【实例截图】VS2017开发
【核心代码】
配置文件
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Configuration;
namespace ftpupload
{
public class FTPUpload
{
static FtpWebRequest reqFTP;
static WebResponse response;
static StreamReader ftpStream;
static Stream strm;
static FileStream fs;
//const string temp = "temp";
static string filenametemp = "";
static string ftpServerIP = ConfigurationManager.AppSettings["ftpIP"];
static string ftpUserID = ConfigurationManager.AppSettings["ftpuid"];
static string ftpPassword = ConfigurationManager.AppSettings["ftppass"];
///
/// 上传
///
/// 绝对路径
/// 经销商文件夹名称
///
public static bool Upload(string path, string filename)
{
bool bol = false;
string ftppath = @"ftp://" ftpServerIP;
//fileRename(ftppath, "Test1", temp);
if (CheckFTPFile(filename, ftppath))
{
if (StatusUpLoad("", filename, path, ftppath))
{
bol = true;
}
}
else
{
if (CreateFile(ftppath "/" filename))
{
if (StatusUpLoad("", filename, path, ftppath))
{
bol = true;