Link to home
Start Free TrialLog in
Avatar of briankam
briankam

asked on

Submit ColdFusion form with data and input type=file

I have a html coldfusion data entry form in a coldbox framework and using jQuery instead of javascript. I submit the form with many input fields along with an input type=file. The form tag  has  enctype="multipart/form-data" method=”post”. The form will not submit.
No errors come up when I click submit (but the jQuery does run), it just will not submit the form or go into the cffunction. When I remove the type=file from the form and the enctype="multipart/form-data" from the form tag, the form submits.
Is there a plugin in for coldbox that I am missing or is there a jQuery function that I need to add?
Thank you very much
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

You CANNOT do submit by script when you use file uploads.
Otherwise you could upload my creditcard.,txt and my password.txt to your server.
Upload is allowed ONLY manualy by user click on submit button and not by script.

And do not tell me that Google is able to do it. I know...
ASKER CERTIFIED SOLUTION
Avatar of briankam
briankam

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hammo777
Hammo777

To upload the file use this in the page your form submits to:
<CfFile Action="UPLOAD" FileField="fname"      NameConflict="overwrite" Destination="#destination#">
where fname is the name of the formfield with type=file.

As for the form not submitting via the submit button, are you sure you aren't getting any JS errors?  Have you tried using Firefox with the Firebug addon to test it for errors.

Can you post your code for the form page?
CFFile and CFFunction are both server side actions AFTER the form submit was initiated.

It is not possible to SET the value of file field.
I assume that some file field checking script has some access or syntax errors and therefore the onSubmit return code is false and the submit action is blocked.

Is you page accessible online?
Avatar of briankam

ASKER

This comment led us to debug our problem