示例#1
0
        [RequestSizeLimit(4294967295)]         //set max allowed request content length to 4GB - 1byte, the configuration in the web.config file does not work in .net core 3.0 preview 6
        public async Task <IActionResult> PostFile(IFormFile file, IDictionary <string, string> customProperties)
        {
            var tempFileHandle = await downloadService.Download(file.OpenReadStream(), file.FileName);

            string bundleId = superDumpRepo.ProcessLocalInputfile(file.FileName, tempFileHandle, customProperties);

            if (bundleId != null)
            {
                logger.LogFileUpload("Api Upload", HttpContext, bundleId, customProperties, file.FileName);
                return(CreatedAtAction(nameof(HomeController.BundleCreated), "Home", new { bundleId = bundleId }, null));
            }
            else
            {
                // in case the input was just symbol files, we don't get a bundleid.
                return(BadRequest("No dump was found in bundle."));
            }
        }
示例#2
0
        [RequestSizeLimit(4294967295)]         //set max allowed request content length to 4GB - 1byte, the configuration in the web.config file does not work in .net core 3.0 preview 6
        public async Task <IActionResult> Upload(IFormFile file, string refurl, string note)
        {
            if (ModelState.IsValid)
            {
                pathHelper.PrepareDirectories();
                if (file.Length > 0)
                {
                    var tempFileHandle = await downloadService.Download(file.OpenReadStream(), file.FileName);

                    string bundleId = superDumpRepo.ProcessLocalInputfile(file.FileName, tempFileHandle, new Dictionary <string, string> {
                        { "ref", refurl }, { "note", note }
                    });
                    return(RedirectToAction("BundleCreated", "Home", new { bundleId = bundleId }));
                }
                return(View("UploadError", new Error("No filename was provided.", "")));
            }
            else
            {
                return(View("UploadError", new Error("Invalid model", "Invalid model")));
            }
        }