Ejemplo n.º 1
0
        public async Task <IActionResult> Upload(IFormFile file, int dirId)
        {
            long size = file.Length;

            var text = string.Empty;

            if (file.Length > 0)
            {
                using (var reader = new StreamReader(file.OpenReadStream()))
                {
                    text = await reader.ReadToEndAsync();
                }
            }

            if (text == string.Empty)
            {
                //TODO: return warning or something
                return(Ok());
            }

            saveData.UploadData(text, dirId);

            return(Ok());
        }