Allow Server Side validation during upload #25
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a step during the upload process to validate the uploaded file on the server side.
Use case: I allow users to upload a single file with specific restrictions. I handle the file directly during the upload without using a form button, making server-side validation essential.
This feature is optional, so those who don't need it won't have to modify their existing code.
Server side validation returns error (multiple set to true)
![file-server-error](https://private-user-images.githubusercontent.com/221351/375360064-c8e52a05-7036-4cf9-a8de-104e15b4045c.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg3ODQ2MzYsIm5iZiI6MTczODc4NDMzNiwicGF0aCI6Ii8yMjEzNTEvMzc1MzYwMDY0LWM4ZTUyYTA1LTcwMzYtNGNmOS1hOGRlLTEwNGUxNWI0MDQ1Yy5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwNVQxOTM4NTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hOGJlZDgyM2Q0NWNiYWZiMjFiZDMxMjA4NTJiNTk0MjQ5MGEyMmExZTgyN2U3ODFhNGFlODZmOThiMzJmMzdiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.SDyjUiTR7IhJ5iFtPdMsT-PewfB0OLy14EowGsv2NtE)
Example without server side validation (multiple set to true)
![File-Success](https://private-user-images.githubusercontent.com/221351/375360175-f2e1f2fc-e7cf-4b28-9be1-1213863b6182.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg3ODQ2MzYsIm5iZiI6MTczODc4NDMzNiwicGF0aCI6Ii8yMjEzNTEvMzc1MzYwMTc1LWYyZTFmMmZjLWU3Y2YtNGIyOC05YmUxLTEyMTM4NjNiNjE4Mi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwNVQxOTM4NTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jMmQyZGZmODcwZTEyZGY0MWI5Y2RjY2JlYTJlZTM3MzhkYWU5Yjg3YWMwMTRmYmVhZTAzMGMzZGE5OTdjNzI0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.4xyCU90S7L7vtoMmT_c9xacfI8V4WNFh5IaHucg9Wyg)
Example for a single file with server side validation (multiple set to false)
![Single-File-Error](https://private-user-images.githubusercontent.com/221351/375360254-16e37d6a-1dae-46a1-be72-b59ea80e321d.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg3ODQ2MzYsIm5iZiI6MTczODc4NDMzNiwicGF0aCI6Ii8yMjEzNTEvMzc1MzYwMjU0LTE2ZTM3ZDZhLTFkYWUtNDZhMS1iZTcyLWI1OWVhODBlMzIxZC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwNVQxOTM4NTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MjEyOTA2Y2UzZmEzZDNlMjQ0ZmM5N2RiZWQzYTRkZDdkMzgzMzJiNzMxMGU4NWQ1MjUxNzQ2NzQ0MmNkNjcyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.knge6NhIo8RkbdEnSxSsLG811vP5kitfCLKmSwLv5o8)