0

I want to buld custom file upload system like dropzone.js.... Without <input> tag... I build this:

var fileSelector = $('<input type="file" name="imageToUpload" id="imageToUpload">');
$(document).ready(function() {
  $("#imageToUpload").hide();
  $("#uploadDiv").on("click", function() {
    fileSelector.click();
  });
});
.uploadDiv {
  border: 2px dotted lightblue;
  height: 100px;
  margin-top: 100px;
}

.uploadDiv:hover {
  cursor: pointer;
  border: 2px solid lightblue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="uploadDiv" id="uploadDiv">
  <small>Click to select <strong>image</strong> for upload.</small>
</div>

But how i can take file and work with php and ajax?

Mosh Feu
  • 28,354
  • 16
  • 88
  • 135
Kosta
  • 37
  • 6
  • 1
    Maybe [this](https://stackoverflow.com/q/2320069/863110) question can help you. – Mosh Feu Apr 23 '18 at 15:00
  • 1
    Possible duplicate of https://stackoverflow.com/questions/6974684/how-to-send-formdata-objects-with-ajax-requests-in-jquery – 16kb Apr 23 '18 at 15:01
  • 1
    Possible duplicate of [How to send FormData objects with Ajax-requests in jQuery?](https://stackoverflow.com/questions/6974684/how-to-send-formdata-objects-with-ajax-requests-in-jquery) – Samvel Aleqsanyan Apr 23 '18 at 15:38

0 Answers0