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
fd=newFormData()
# Sanity check of file size
file_too_large=false
# Sanity checks on submission
max_filesize=4*1000*1000# 4 MB
file_too_large=false
file_not_selected=false
@inputs.each(index,element)->
ifelement.typeis'file'
ifelement.files[0]instanceofFile
ifelement.files[0].size>max_filesize
forfileinelement.files
iffile.size>max_filesize
file_too_large=true
alert'Submission aborted! Your file "'+element.files[0].name+'" is too large (max size: '+max_filesize/(1000*1000)+' MB)'
fd.append(element.id,element.files[0])
else
fd.append(element.id,'')
alert'Submission aborted! Your file "'+file.name'" is too large (max size: '+max_filesize/(1000*1000)+' MB)'
fd.append(element.id,file)
ifelement.files.length==0
file_not_selected=true
fd.append(element.id,'')# In case we want to allow submissions with no file
else
fd.append(element.id,element.value)
iffile_not_selected
alert'Submission aborted! You did not select any files to submit'