后台代码:
for (int i = 0; i < request.Files.Count; i++)
{
var file = request.Files[i];
string key = request.Files.GetKey(i);
if (key.Equals("image"))//uploadfile.js file name
{
DocumentFileDataInfo fileInfo = new DocumentFileDataInfo()
{
Name = file.FileName,
Suffix = Path.GetExtension(file.FileName),
Stream = file.InputStream,
CreationUserID = CurrentUser
};
data.ImageUploadDocumentFiles.Add(fileInfo);
}
if (key.Equals("file"))
{
DocumentFileDataInfo fileInfo = new DocumentFileDataInfo()
{
Name = file.FileName,
Suffix = Path.GetExtension(file.FileName),
Stream = file.InputStream,
CreationUserID = CurrentUser
};
data.AttachmentUploadDocumentFiles.Add(fileInfo);
}
}
{
var file = request.Files[i];
string key = request.Files.GetKey(i);
if (key.Equals("image"))//uploadfile.js file name
{
DocumentFileDataInfo fileInfo = new DocumentFileDataInfo()
{
Name = file.FileName,
Suffix = Path.GetExtension(file.FileName),
Stream = file.InputStream,
CreationUserID = CurrentUser
};
data.ImageUploadDocumentFiles.Add(fileInfo);
}
if (key.Equals("file"))
{
DocumentFileDataInfo fileInfo = new DocumentFileDataInfo()
{
Name = file.FileName,
Suffix = Path.GetExtension(file.FileName),
Stream = file.InputStream,
CreationUserID = CurrentUser
};
data.AttachmentUploadDocumentFiles.Add(fileInfo);
}
}
git:
https://github.com/pijiahao/upload-file.git