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

4
  • 1
    How are you initiating the upload without a submit button? Commented Apr 4, 2014 at 20:15
  • so how Facebook upload the image directly when the user choose it ?? Commented Apr 4, 2014 at 20:19
  • Where are you uploading to? You won't be able to upload anything without a form which initiates the request for the upload to a destination. Commented Apr 4, 2014 at 20:22
  • i think you cand to this but with hiding the submit button and trigger it with javascript when the file input is set:-? Commented Apr 4, 2014 at 20:24

2 Answers 2

1

Jquery upload, dropzone.

or

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

Sign up to request clarification or add additional context in comments.

Comments

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?

1 Comment

yes I will use JavaScript to submit it thank you for the help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.