I have developed quite a large application with multiple file upload points in the UI to upload various files. All was working fine. Now one of the upload components stopped working. What I mean by this is that all the workflow methods (OnSelect, OnUpload) fire correctly but then, when it needs to call the server to process the upload, it just does nothing without returning an error or anything. The other upload components still work 100%. I have even copied the upload component tag from the razor page that is working and replaced the upload tag in the page that is not working and still it does not work. The difference is that on the one that is working it is on the page in a gridtoolbar while on the one that is not working the grid is on a tabstriptab on another page. The controller method is never hit and the browser console as well as the server logs do not indicate the upload post action being made.
The solution is way too big to post here and I have already established that the upload can work. Does anyone have some pointers as to where and how to trace the probable cause of this behaviour?
I am using a Telerik Upload in one of my project that is currently using Microsoft Azure to host it in the cloud. After a successful submission, my file (which is an image file) should have been saved to my specified location within my project, but it is not.
Initially, I thought the submission was successful. However, after using the Developer tools and testing out the file validation methods I found in the Telerik Blazor File Upload demo (https://demos.telerik.com/blazor-ui/upload/overview) in my @code, it is clear to me that the submission was valid.
Something else must have been the problem, but I do not know what. Attached is the image for the API endpoint SaveUrl.
Thank you in advance!
{ Note! I am a desktop dev, very little Web.. so bare with my dumb ?s }
My issue is with the line: file.CopyToAsync
I dont see that CopyToAsync. Guessing becuase my file = file in args.Files
How can I get that CopyToAsync, so I can upload a file?
Thanks in advance.
I have on my razor page
<div class="k-form-field">
<label class="k-label k-form-label">Files:</label>
<div class="k-form-field-wrap">
<TelerikUpload Id="DuffUpLoader"
SaveUrl="@SaveUrl"
RemoveUrl="@RemoveUrl"
OnUpload="@OnUpload"
AutoUpload="false">
</TelerikUpload>
</div>
</div>
<style>
.k-upload-files {
max-height: 200px;
overflow-y: auto;
}
</style>
in my behind the code:
public string SaveUrl => ToAbsoluteUrl("Resources/upload/save");
public string RemoveUrl => ToAbsoluteUrl("Resources/upload/remove");
private async Task OnUpload(UploadEventArgs args)
{
foreach (var file in args.Files)
{
using (var fileStream = new FileStream(SaveUrl, FileMode.Create))
{
await file.CopyToAsync(fileStream);
};
//await using FileStream fs = new(SaveUrl, FileMode.Create);
//await file.OpenReadStream().CopyToAsync(fs);
};
}
Hello,
Is there a way to fire an event (or listen to an existing one) for the Upload control when the user clicks on a file that has been added to the Files list of the Upload control? I'm populating the list of pre-existing files for records and I'd like to be able to let the user download them.
Thanks
Hello,
I'm using the (excellent) TelerikUpload component in our Blazor app and I'm trying to set the initial files list for previously-uploaded files as specified here: https://docs.telerik.com/blazor-ui/components/upload/initial-files . When I try to do something like
Uploader.Files = new List<UploadFileInfo>();
I get the error that 'TelerikUploadBase<UploadFileInfo>.Files' is inaccessible due to its protection level.
If I try to set it as a parameter on the component declaration on my page, I get the error that Files isn't set a a ParameterAttribute or CascadingParameter.
Am I missing something?
Any idea why this would work when running locally but returns "Unauthorized" when running in a Azure Web App? Using AAD for authentication and the Blazor Upload calls to the same controller work fine. I tried to get the User Token when the app starts, but it is null.
HttpClient client = ClientFactory.CreateClient();
var response = await client.PostAsJsonAsync<UploadDataViewModel>(ToAbsoluteUrl("api/IntUpload/savenotes"), _model);
if (response.IsSuccessStatusCode)
{
ShowNotification("success", "Notes file was successfully recorded.");
}
else
{
ShowNotification("error", "Notes file failed to upload.");
}
This is what I'm using for authentication in the Program.cs file:
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
I believe this broke with the 4.01 changes?
I can no longer drop a file on the upload button, it just does the default "open file with browser" action.
Hello
I set Multiple="true" and I wonder if it's possible to "see" in OnSuccess event the last success upload. Or another event. I need to do something after ALL files are uploaded succefully.
<TelerikUpload SaveUrl="@ImageSaveApiURL"
AllowedExtensions="@AllowedFileTypes"
MaxFileSize="@MaxFileSize"
Multiple="true"
@ref="uploadAlbumPhotosRef"
OnSuccess="OnUploadSuccessHandler"
OnUpload="OnFileUploadHandler" >
</TelerikUpload>
async Task uploadAlbumPhotosRef(UploadSuccessEventArgs e) { if (e.Request.Status == 201) { var infos = new trelAlbumPhotoViewModel(); infos.Id = (Guid)Id; infos.NomFichier = e.Request.ResponseText; FicheEspaceClosDataService.AjouterPhotosAsync(infos); await AfficherPhotos(); //albumPhotosRef.Rebind(); } }
On the Blazor Upload demo page it shows the control with a "drag and drop" option. I haven't been able to find information on the site on how to implement that. I have found a few places where it makes it sound as if that is not yet possible. Can you direct me to a location where it has further information on that feature? Thanks