SharePoint 2016 平台 开发FTP的上传下载和删除功能
先说效果,然后贴出代码:
- 文件上传,多文件上传
- 拖拽上传。
上传成功
- 上传成功查看FTP服务器的文件是否存在。
- 如果删除,单击前面的多选框然后再选删除就可以了。
- 下载,要求有文件另存为;
- 代码如下
using CoreFtp.Infrastructure;
using EBIP.Platform.Core.AuthServer;
using EBIP.Platform.Core.FTP.Application;
using EBIP.Platform.Core.FTP.FTPServer;
using EBIP.Platform.Core.FTP.Model;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using static EBIP.Platform.Core.FTP.Model.MessageResult;
namespace EBIP.Platform.Core.FTP.Controllers
{
//[Produces("application/x-www-form-urlencoded")]
[Route("api/[controller]")]
public class ValuesController : Controller
{
private readonly OperationServerFile operationServerFile;
private IHostingEnvironment hostingEnv;
private readonly FileHelper fileHelper;
public ValuesController(OperationServerFile operationServerFile, IHostingEnvironment env, FileHelper fileHelper)
{
this.operationServerFile = operationServerFile;
this.hostingEnv = env;