How to prevents users from dragging and dropping files from a compressed zip folder in upload control
1 Answer, 1 is accepted
0
Rumen
Telerik team
answered on 04 Aug 2025, 11:28 AM
Hi Afroz,
RadAsyncUpload does not provide a built-in way to detect or block files that are dragged and dropped from inside a compressed ZIP folder. When a user drags a file out of a ZIP archive and drops it onto the upload area, the browser treats it as a regular file, so there is no metadata or property available to determine its origin.
Current Options and Limitations:
Blocking ZIP Files: You can block users from uploading ZIP files themselves by validating file extensions (e.g., ".zip"). However, this does not prevent users from extracting files from a ZIP and then uploading them.
Detecting ZIP-Origin Files: There is no browser API or client-side JavaScript method to determine if a dropped file was originally inside a ZIP archive. All files, regardless of their source, are seen as regular files by the upload control.
Client-Side Validation: You can use the OnClientFileDropped event to inspect file properties (such as name or type) and implement custom rules, but you cannot detect ZIP-origin files this way.
Alternative Approaches:
Server-Side Validation: If there are specific file types or content you want to block, consider adding server-side validation after upload to inspect file signatures or contents.
Disabling Drag and Drop: If drag and drop is not required, you can disable this functionality in RadAsyncUpload to force users to use the file picker dialog, which might help control the user experience:
It is not technically possible to prevent users from dragging and dropping files that were extracted from a ZIP folder, as browsers do not expose this information.
You can block ZIP files by extension or disable drag-and-drop if that helps your scenario.