Reputation: 83
Is it possible to upload an img and store it in DB without a submit button?
CSS
#upload-file-container {
width: 90px;
height: 90px;
position: relative;
border:2px solid;
border-radius:20px;
border-color:rgb(58,147,231);
color:rgb(58,147,231);
overflow: hidden;
float:right;
}
#upload-file-container input[type="file"] {
margin: 0;
opacity: 0;
font-size: 100px;
}
HTML
<div id="upload-file-container" >
<input type="file" value="No Picture"/>
</div>
or do you have to put a submit button to be able to store it ? I wonder ؟_؟
Upvotes: 0
Views: 1930
Reputation: 3416
You cannot. It requires a form and a form submits info using submit button or you can use JavaScript. Something like this document.getElementById('theForm').submit();
Source: How to submit a form using javascript?
Upvotes: 0
Reputation: 1182
or
DropzoneJS is an open source library that provides drag'n'drop file uploads with image previews.
Upvotes: 1