How to validate file size function before submitting form,

How to validate file size function before submitting form,

Friends, I am using  jquery.validate plugin. from here
I am not so smart in jquery. 
My query is, 
  1. File size should be validate before submitting, for example maximum file size 500 kb
  2. the validation error should be the same according to the form.
Here is the url of demo, i already mentioned the jotform upload url with code inside the demo. 


Please let me know 

yashmistrey[a]gmail.com