I have this image upload form that I check on 'change' for file type and file size. If a file is above a certain size or if its not an image, it'll alert the user. Problem I'm having is, how do I prevent the form from being submitted when this is the case. If I were to click the upload button the file submits. Actually it should not until the file is a certain size and type. Can you help me set this right? I've tried, but I just cannot figure out where and what to do. You need to take into account that if the user selects one valid file but changes it to an invalid one before form submit, he will get alerted but isValid will remain true (since it was only initialized on DOMReady). So you might want to add isValid = false; at the beginning of the change event handler function. -- spider Oct 9 at 15:10 @spider That's the way it is right now, right? -- Norman Oct 9 at 15:15 @spider .. I set that the false initially , to handle the condition wherein the user might click the submit button without changing the file .. -- Sushanth -- Oct 9 at 15:18 @spider You are right. Select a valid file first and don't submit it. Then select and Invalid file and it get submitted. So where where exactly should this var isValid = false; go. Before which part or line. Honestly, I'm -1