0

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 ؟_؟

brobken
  • 358
  • 1
  • 12
Abeer
  • 83
  • 1
  • 2
  • 12

2 Answers2

1

Jquery upload, dropzone.

or

DropzoneJS is an open source library that provides drag'n'drop file uploads with image previews.

dikkini
  • 1,184
  • 1
  • 23
  • 52
0

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?

Community
  • 1
  • 1
Aishwarya Shiva
  • 3,460
  • 15
  • 58
  • 107