Skip to content

Instantly share code, notes, and snippets.

@betahikaru
Created May 26, 2016 14:58
Show Gist options
  • Save betahikaru/d7f2ad345778310fbe3c11b817cad4f0 to your computer and use it in GitHub Desktop.
Save betahikaru/d7f2ad345778310fbe3c11b817cad4f0 to your computer and use it in GitHub Desktop.
React.jsのformタグは 正:encType 誤:enctype ref: http://qiita.com/betahikaru/items/d5d35b6c87cab89d1ff5
// ソース
var SomeComponent = React.createClass({
...
render: function() {
return (
<form action="/upload" method="POST" encType="multipart/form-data">
<input type="file" name="file_input" />
<input type="submit" value="Upload" />
</form>
);
}
});
<!-- レンダリング結果 - enctype属性が存在する😊 -->
<form action="/api/file" method="POST" enctype="multipart/form-data">
<input type="file" name="file1">
<input type="submit" value="Upload">
</form>
// ソース
var SomeComponent = React.createClass({
...
render: function() {
return (
<form action="/upload" method="POST" enctype="multipart/form-data">
<input type="file" name="file_input" />
<input type="submit" value="Upload" />
</form>
);
}
});
<!-- レンダリング結果 - enctype属性が存在しない!😢 -->
<form action="/api/file" method="POST">
<input type="file" name="file1">
<input type="submit" value="Upload">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment