Reputation: 419
My question is straightforward, i want my Form to be just an input button to browse for the file and do the work too instead of two inputs like in the image bellow : here is my code :
**EDIT : ** all I want is ONE BUTTON not two like in the picture , one button to do the work preferably called "upload image" in the image bellow the form consists of two buttons one does the choosing and another one does the submitting of the form action.
<form class='formUpload' action="uploadImage.php" method="POST" enctype="multipart/form-data">
<input value="Upload Image" class="ToUpload" name="fileToUpload" type="file" />
<input type="submit" name="fileToUpload" value="Upload Image">
</form>
Upvotes: 0
Views: 1017
Reputation: 1046
ok let me add an example asumming you are expecting the same here is something that you might be looking:
HTML:
<form method="post" action="abc.php" name="imageform" id="imageform">
Choose File :<input type="file" name="file" id='fileupload'>
</form>
js:
$(document).ready(function(){
$('#fileupload').on('change',function(){
$('#imageform').submit();
});
});
Upvotes: 2