I'm sorry for my english.
I have a question, I have a form that contain a file input and other text inputs, when the user selected an image and filled other inputs in the form , should I upload the file to the server before user actually hit the submit button, or when he hits the button. If I should upload the file before then how I gonna clean up the unnecessary files if the user doesn't complete the form and didn't hit the submit button or he close the browser before submitting the form .
Sorry again for my english
Both are OK, depending on the business logic.
For better UX, uploading it before feels much faster, but on the other hand, it is much more complex to develop. On the backend side, for example, you might have a cron job to delete all images that were uploaded and not used(eg: the user left the site). Also in some cases, you need to create the form first to get its ID.
Uploading when the user clicks the submit button is much easier to develop.
If you are new, I'd recommend uploading only when the user clicks on the submit button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With