Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
122
rated 0 times [  126] [ 4]  / answers: 1 / hits: 5227  / 11 Years ago, mon, january 27, 2014, 12:00:00

I am trying to write a simple upload form with input file type using React JS. When i submit the file, it is not submitting multi form data. It is submitting plain input file name.



Do we need to make any other changes if we want to write upload functionality in React.



Basic javascript code for uploading (js fiddle link) :



    /** @jsx React.DOM */
var HelloMessage = React.createClass({
render: function() {
return (<div>

<form name=secret ENCTYPE=multipart/form-data method=POST action=http://localhost:8080/uploadFile>
Please choose two files to upload.
<br/>
File 1:<input type=file id=profilePic name=profilePic/>
<br/>
<input type=submit value=submit/>
</form>
</div>);
}
});

React.renderComponent(<HelloMessage />, document.body);


Can someone help me to write using React JS.


More From » html

 Answers
3

Casing is important for React components. Try encType instead of ENCTYPE. (You should have seen a warning in your console suggesting that you use encType.)



Here's a complete list of tags and attributes:DOM Elements.


[#48308] Sunday, January 26, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
angelicajayleneh

Total Points: 216
Total Questions: 110
Total Answers: 100

Location: Sudan
Member since Tue, Aug 3, 2021
3 Years ago
;