RadzenFileInput breaks if both MaxWidth and MaxHeight is set and a non image is selected #1580

Closed
opened 2026-01-29 17:55:40 +00:00 by claunia · 0 comments
Owner

Originally created by @HeruEwasham on GitHub (Jan 23, 2025).

Describe the bug
If you decide to specify both the MaxWidth and MaxHeight, and try to select a non-image, like an mp3- or text-file, it will not work, but will not give you an error either. But if either MaxHeight or MaxWidth is omitted, it works as expected/normal for non-image-files.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the official demo: https://blazor.radzen.com/fileinput?theme=material3
  2. Click to edit the source of one of the examples.
  3. Add both a MaxWidth-, a MaxHeight-, and an Accept-attribute to the RadzenFileInput-component. The Accept-attribute is needed to allow you to set something else than images. Example: ´MaxHeight="500" MaxWidth="500" Accept="text/,audio/,image/*"´
  4. Click Run
  5. Select an image-file, and see that the Change-event logs to the Console-log
  6. Select a non-image file.
  7. See that things don't work. The Change-event will for instance not be triggered.
  8. if you edit away MaxHeigth or MaxWidth, and run it again, and try a non-image, everything works as expected.

Expected behavior
I Expect that even if I decide to add both a MaxWidth and a MaxHeight, It will still work as expected for all the different files.

Screenshots
It is better to experience it.

Desktop (please complete the following information):

  • OS: Experienced on both Windows and Mac
  • Browser Tried both Safari, Edge and Chrome, etc.
  • Version ....

Additional context
Add any other context about the problem here.

Originally created by @HeruEwasham on GitHub (Jan 23, 2025). **Describe the bug** If you decide to specify both the MaxWidth and MaxHeight, and try to select a non-image, like an mp3- or text-file, it will not work, but will not give you an error either. But if either MaxHeight or MaxWidth is omitted, it works as expected/normal for non-image-files. **To Reproduce** Steps to reproduce the behavior: 1. Go to the official demo: https://blazor.radzen.com/fileinput?theme=material3 2. Click to edit the source of one of the examples. 3. Add both a MaxWidth-, a MaxHeight-, and an Accept-attribute to the RadzenFileInput-component. The Accept-attribute is needed to allow you to set something else than images. Example: ´MaxHeight="500" MaxWidth="500" Accept="text/*,audio/*,image/*"´ 4. Click Run 5. Select an image-file, and see that the Change-event logs to the Console-log 6. Select a non-image file. 7. See that things don't work. The Change-event will for instance not be triggered. 8. if you edit away MaxHeigth or MaxWidth, and run it again, and try a non-image, everything works as expected. **Expected behavior** I Expect that even if I decide to add both a MaxWidth and a MaxHeight, It will still work as expected for all the different files. **Screenshots** It is better to experience it. **Desktop (please complete the following information):** - OS: Experienced on both Windows and Mac - Browser Tried both Safari, Edge and Chrome, etc. - Version .... **Additional context** Add any other context about the problem here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1580