diff --git a/products/ASC.Files/Core/Model/InsertFileModel.cs b/products/ASC.Files/Core/Model/InsertFileModel.cs
index 8f7b821598..16d4753c2f 100644
--- a/products/ASC.Files/Core/Model/InsertFileModel.cs
+++ b/products/ASC.Files/Core/Model/InsertFileModel.cs
@@ -1,10 +1,11 @@
-using System.IO;
-
+
+using Microsoft.AspNetCore.Http;
+
namespace ASC.Files.Core.Model
{
public class InsertFileModel
{
- public Stream File { get; set; }
+ public IFormFile File { get; set; }
public string Title { get; set; }
public bool? CreateNewIfExist { get; set; }
public bool KeepConvertStatus { get; set; }
diff --git a/products/ASC.Files/Server/Controllers/FilesController.cs b/products/ASC.Files/Server/Controllers/FilesController.cs
index 0dcc3c30fc..d6c2e271e3 100644
--- a/products/ASC.Files/Server/Controllers/FilesController.cs
+++ b/products/ASC.Files/Server/Controllers/FilesController.cs
@@ -509,14 +509,7 @@ namespace ASC.Api.Documents
/// Uploads
///
[Create("@my/insert")]
- public FileWrapper InsertFileToMyFromBody([FromBody]InsertFileModel model)
- {
- return InsertFile(GlobalFolderHelper.FolderMy, model);
- }
-
- [Create("@my/insert")]
- [Consumes("application/x-www-form-urlencoded")]
- public FileWrapper InsertFileToMyFromForm([FromForm]InsertFileModel model)
+ public FileWrapper InsertFileToMyFromBody([FromForm] InsertFileModel model)
{
return InsertFile(GlobalFolderHelper.FolderMy, model);
}
@@ -531,14 +524,7 @@ namespace ASC.Api.Documents
/// Uploads
///
[Create("@common/insert")]
- public FileWrapper InsertFileToCommonFromBody([FromBody]InsertFileModel model)
- {
- return InsertFile(GlobalFolderHelper.FolderCommon, model);
- }
-
- [Create("@common/insert")]
- [Consumes("application/x-www-form-urlencoded")]
- public FileWrapper InsertFileToCommonFromForm([FromForm]InsertFileModel model)
+ public FileWrapper InsertFileToCommonFromBody([FromForm] InsertFileModel model)
{
return InsertFile(GlobalFolderHelper.FolderCommon, model);
}
@@ -554,31 +540,12 @@ namespace ASC.Api.Documents
/// Uploads
///
[Create("{folderId}/insert", order: int.MaxValue, DisableFormat = true)]
- public FileWrapper InsertFileFromBody(string folderId, [FromBody]InsertFileModel model)
+ public FileWrapper InsertFile(string folderId, [FromForm] InsertFileModel model)
{
- return InsertFile(folderId, model);
- }
-
- [Create("{folderId}/insert", order: int.MaxValue, DisableFormat = true)]
- [Consumes("application/x-www-form-urlencoded")]
- public FileWrapper InsertFileFromForm(string folderId, [FromForm]InsertFileModel model)
- {
- return InsertFile(folderId, model);
- }
-
- private FileWrapper InsertFile(string folderId, InsertFileModel model)
- {
- return FilesControllerHelperString.InsertFile(folderId, model.File, model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
+ return FilesControllerHelperString.InsertFile(folderId, model.File.OpenReadStream(), model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
}
[Create("{folderId:int}/insert", order: int.MaxValue - 1)]
- public FileWrapper InsertFileFromBody(int folderId, [FromBody]InsertFileModel model)
- {
- return InsertFile(folderId, model);
- }
-
- [Create("{folderId:int}/insert", order: int.MaxValue - 1)]
- [Consumes("application/x-www-form-urlencoded")]
public FileWrapper InsertFileFromForm(int folderId, [FromForm]InsertFileModel model)
{
return InsertFile(folderId, model);
@@ -586,7 +553,7 @@ namespace ASC.Api.Documents
private FileWrapper InsertFile(int folderId, InsertFileModel model)
{
- return FilesControllerHelperInt.InsertFile(folderId, model.File, model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
+ return FilesControllerHelperInt.InsertFile(folderId, model.File.OpenReadStream(), model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
}
///