using System;
|
|
namespace PDA
|
{
|
public class PDAOperate
|
{
|
public static WebResponseContent UploadApp(List<Microsoft.AspNetCore.Http.IFormFile> files)
|
{
|
try
|
{
|
if (files == null || files.Count == 0)
|
return new WebResponseContent { Status = true, Message = "请选择上传的文件" };
|
Microsoft.AspNetCore.Http.IFormFile formFile = files[0];
|
string dicPath = $"Upload/App/".MapPath();
|
if (!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath);
|
string path = $"{dicPath}WMS-PDA{DateTime.Now:yyyyMMddhhmmss}.apk";
|
dicPath = $"{dicPath}WMS-PDA.apk";
|
File.Move(dicPath, path);
|
|
using (var stream = new FileStream(dicPath, FileMode.Create))
|
{
|
formFile.CopyTo(stream);
|
}
|
return new WebResponseContent { Status = true, Message = "文件上传成功" };
|
}
|
catch (Exception ex)
|
{
|
return WebResponseContent.Instance.Error(ex.Message);
|
}
|
}
|
}
|
}
|