Radzen Upload component - File Location

Good evening!

I'm trying to use the Upload component and connecting with Azure Blob Storage. I managed to perform every step correctly but when I upload the file it says the path is not correct. I'm using the file.Name as the argument and in debug... he thinks the file is in the project's root. (I've uploaded from my PC Downloads folder)

I need to use the correct argument but I can't figure it out :frowning:

Here's the code:

<RadzenUpload Accept="document/.pdf" Url="upload/single" Progress="@((args) => OnProgress(args, "Uploading file..."))"/>

void OnProgress(UploadProgressArgs args, string name)
        this.info = $"% - '{name}' / {args.Loaded} of {args.Total} bytes.";
        this.progress = args.Progress;

        if (args.Progress == 100)
            string connectionString = Environment.GetEnvironmentVariable("Azure__Storage__ConnectionString");
            string containerName = "hightide";
            string blobName = "pitchdecks";

            // Get a reference to a container named "sample-container" and then create it
            BlobContainerClient container = new BlobContainerClient(connectionString, containerName);

            // Get a reference to a blob named "sample-file" in a container named "sample-container"
            BlobClient blob = container.GetBlobClient(blobName);

            this.info = $"% - '{"Upload completed!"}' / {args.Loaded} of {args.Total} bytes.";

            foreach (var file in args.Files)
                // Upload local file

Hi @svrebelo,

I'm not sure I understand your question. Do you want to get from where the file is uploaded? Your local file path? This is especially restricted in all browsers since it is a security threat.

@enchev I mean, when I try to upload the file, I get an exception of file not found. I use the parameter file.Name inside the method.

The code you see is to upload the file to Azure Blob Storage but I can't get it working

file.Name is the local name of the file the user has selected e.g. test.jpg (without the full path). You should upload the files from the controller you have specified where you have the stream of data.

@korchev thanks for your feedback. I didn't create any controller for this. Just the component and its events. Is there any document I can guide myself?

Thanks in advance.

The official documentation of the Radzen Upload shows a sample implementation.

@korchev Thanks a lot! I'll give feedback after I do this :slight_smile:

@korchev I managed to bind the event and it is working so far.

Just having a little trouble on code completion (see image):

Well IFormFile is not a stream. You should check the IFormFile API reference which shows how to work with streams.

Working like a charm. Here's the code if someone needs :slight_smile:

Thanks @korchev !!!!