Files upload
Medias
MediaService contains the code needed to upload the files. Although the code was inspired by official Microsoft documentation (see references), we had to change the code, because temporary files have an automatically generated extension (.tmp extension), regardless of the type of file uploaded. If we uploaded an image, csv file, etc, they all had a .tmp extension. This problem has been fixed with the code below:
string tempFileName = Path.GetTempFileName();
string extension = new FileInfo(formFile.FileName).Extension;
string tempFileNameWithExtension = Path.ChangeExtension(tempFileName, extension);