alert"Sorry, your browser does not support file uploads. Your submit request could not be fulfilled. If you can, please use Chrome or Safari which have been verified to support file uploads."
alert"Submission aborted! Sorry, your browser does not support file uploads. If you can, please use Chrome or Safari which have been verified to support file uploads."
return
return
fd=newFormData()
fd=newFormData()
# Sanity check of file size
# Sanity checks on submission
abort_submission=false
max_filesize=4*1000*1000# 4 MB
max_filesize=4*1000*1000# 4 MB
file_too_large=false
file_not_selected=false
@inputs.each(index,element)->
@inputs.each(index,element)->
ifelement.typeis'file'
ifelement.typeis'file'
forfileinelement.files
forfileinelement.files
iffile.size>max_filesize
iffile.size>max_filesize
abort_submission=true
file_too_large=true
alert'Submission aborted! Your file "'+file.name'" is too large (max size: '+max_filesize/(1000*1000)+' MB)'
alert'Submission aborted! Your file "'+file.name'" is too large (max size: '+max_filesize/(1000*1000)+' MB)'
fd.append(element.id,file)
fd.append(element.id,file)
ifelement.files.length==0
ifelement.files.length==0
abort_submission=true
file_not_selected=true
alert'Submission aborted! You did not select any files to submit'
fd.append(element.id,'')# In case we want to allow submissions with no file
fd.append(element.id,'')
else
else
fd.append(element.id,element.value)
fd.append(element.id,element.value)
iffile_not_selected
alert'Submission aborted! You did not select any files to submit'