I’m looking for help adding to this Upload Form. Currently if you upload the wrong size or wrong format the corresponding error message appears, but the erroneous action can still proceed.
How can I halt the ‘Submit’ until the correct file format is chosen?
How can I halt the ‘Submit’ until the correct size is chosen?
Here's some of the Form's html:
<input class="button-form3" type="submit" value="Submit >>" name="B3" />
<input class="upload-form-input" type="hidden" name="form_submitted" value="yes" />
Here, you are just printing “Error: Invalid File Name”. At this point, it should still be in a temp directory (normally, it remains there JUST long enough for it to be moved elsewhere.) Instead of moving the file to another folder, just delete it (if the temp folder doesn’t already do that automatically.)
Thanks for your reply.
So, can code be added to delete an incorrect file format or incorrect file size, when the appropriate error appears? (so that I can change the error messages to essentially say “upload blocked try again”). If so, can you provide a code example, please?
Just to add that until recently JavaScript had no access to client files whatsoever - you had to upload the file to the server before being able to start looking at whether it met the criteria.