Class FileController
- Namespace
- Oqtane.Controllers
- Assembly
- Oqtane.Server.dll
[Route("api/[controller]")]
public class FileController : Controller
- Inheritance
-
objectControllerBaseControllerFileController
Constructors
FileController(IWebHostEnvironment, IFileRepository, IFolderRepository, IUserPermissions, ISettingRepository, ISyncManager, ILogManager, ITenantManager, IImageService)
public FileController(IWebHostEnvironment environment, IFileRepository files, IFolderRepository folders, IUserPermissions userPermissions, ISettingRepository settingRepository, ISyncManager syncManager, ILogManager logger, ITenantManager tenantManager, IImageService imageService)
Parameters
environment
IWebHostEnvironmentfiles
IFileRepositoryfolders
IFolderRepositoryuserPermissions
IUserPermissionssettingRepository
ISettingRepositorysyncManager
ISyncManagerlogger
ILogManagertenantManager
ITenantManagerimageService
IImageService
Methods
Delete(int)
[HttpDelete("{id}")]
[Authorize(Roles = "Registered Users")]
public void Delete(int id)
Parameters
id
int
DownloadAttachment(int)
Get file with header Content-Disposition: attachment; filename="filename.jpg" https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
[HttpGet("download/{id}/attach")]
public IActionResult DownloadAttachment(int id)
Parameters
id
intFile Id from Oqtane filesystem
Returns
- IActionResult
DownloadInline(int)
Get file with header Content-Disposition: inline https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
[HttpGet("download/{id}")]
public IActionResult DownloadInline(int id)
Parameters
id
intFile Id from Oqtane filesystem
Returns
- IActionResult
file content
Get(int)
[HttpGet("{id}")]
public File Get(int id)
Parameters
id
int
Returns
Get(int, string)
[HttpGet("{siteId}/{path}")]
public IEnumerable<File> Get(int siteId, string path)
Parameters
siteId
intpath
string
Returns
- IEnumerable<File>
Get(string)
[HttpGet]
public IEnumerable<File> Get(string folder)
Parameters
folder
string
Returns
- IEnumerable<File>
Get(string, int)
[HttpGet("name/{name}/{folderId}")]
public File Get(string name, int folderId)
Parameters
name
stringfolderId
int
Returns
GetImage(int, int, int, string, string, string, string, string)
[HttpGet("image/{id}/{width}/{height}/{mode}/{position}/{background}/{rotate}/{recreate}")]
public IActionResult GetImage(int id, int width, int height, string mode, string position, string background, string rotate, string recreate)
Parameters
id
intwidth
intheight
intmode
stringposition
stringbackground
stringrotate
stringrecreate
string
Returns
- IActionResult
Post(File)
[HttpPost]
[Authorize(Roles = "Registered Users")]
public File Post(File file)
Parameters
file
File
Returns
Put(int, File)
[HttpPut("{id}")]
[Authorize(Roles = "Registered Users")]
public File Put(int id, File file)
Parameters
id
intfile
File
Returns
Unzip(int)
[HttpPut("unzip/{id}")]
[Authorize(Roles = "Administrators")]
public void Unzip(int id)
Parameters
id
int
UploadFile(string, IFormFile)
[EnableCors("MauiCorsPolicy")]
[HttpPost("upload")]
public Task<IActionResult> UploadFile(string folder, IFormFile formfile)
Parameters
folder
stringformfile
IFormFile
Returns
- Task<IActionResult>
UploadFile(string, string, string)
[HttpGet("upload")]
public Task<File> UploadFile(string url, string folderid, string name)
Parameters
url
stringfolderid
stringname
string
Returns
- Task<File>