public async Task UploadFile()

in src/AIHub/Controllers/VideoAnalyzerController.cs [221:257]


    public async Task<IActionResult> UploadFile(IFormFile videoFile)
    {
        // Check no video
        if (CheckNullValues(videoFile))
        {
            ViewBag.Message = "You must upload an video";
            return View("VideoAnalyzer");
        }
        if (string.IsNullOrEmpty(HttpContext.Request.Form["text"]))
        {
            ViewBag.Message = "You must enter a prompt to evaluate";
            return View("VideoAnalyzer", model);
        }
        model.Prompt = HttpContext.Request.Form["text"];
        // Upload file to azure storage account
        string url = videoFile.FileName.ToString();
        Console.WriteLine(url);

        BlobClient blobClient = containerClient.GetBlobClient(url);
        await blobClient.UploadAsync(videoFile.OpenReadStream(), true);

        // Get the url of the file
        Uri blobUrl = blobClient.Uri;

        if (CheckVideoExtension(blobUrl.ToString()))
        {
            ViewBag.Message = "You must upload an video with .mp4 extension";
            return View("VideoAnalyzer");
        }

        // Call EvaluateVideo with the url
        Console.WriteLine(blobUrl.ToString());
        await DenseCaptionVideo(blobUrl.ToString(), model.Prompt!);
        ViewBag.Waiting = null;

        return Ok(model);
    }