Note that there are some explanatory texts on larger screens.

plurals
  1. PODrag and Drop files uploading error php
    primarykey
    data
    text
    <p>i watched many links on internet and also reffered to each and every question related to this topic but none helped! so plz any1 check this code and tell me where i'm doing wrong?</p> <p>html code: </p> <pre><code> &lt;div class="drop_zone"&gt; &lt;p&gt;Drop Here&lt;/p&gt; &lt;/div&gt; &lt;form enctype="multipart/form-data" id="yourregularuploadformId"&gt; &lt;input type="file" name="files[]" multiple="multiple"&gt; &lt;/form&gt; </code></pre> <p>jQuery and javascript code: </p> <pre><code>function handleFiles(droppedFiles) { var uploadFormData = new FormData($("#yourregularuploadformId")[0]); if(droppedFiles.length &gt; 0) { // checks if any files were dropped for(var f = 0; f &lt; droppedFiles.length; f++) { // for-loop for each file dropped alert(droppedFiles[f]['name']); uploadFormData.append("files[]",droppedFiles[f]); // adding every file to the form so you could upload multiple files } } // the final ajax call alert(uploadFormData); $.ajax({ url : "try.php", // use your target type : "POST", data : uploadFormData, cache : false, contentType : false, processData : false, success : function(ret) { alert(ret); } }); return false; } $(document).ready(function() { //alert("im in"); $('.drop_zone').bind("dragenter", function(e) { // $('#StatusDrag').html('Drop The files Here...'); }); $('.drop_zone').bind("dragleave", function(e) { // $('#StatusDrag').html('Drag and Drop Files Here to Share'); }); $('.drop_zone').bind("dragover", function(e) { e.preventDefault(); return false; }); $('.drop_zone').bind("drop", function(e) { e.preventDefault(); e.stopPropagation(); e.originalEvent.preventDefault(); e.originalEvent.stopPropagation(); // $('#dragBox, #topDiv').hide(); var dt = e.originalEvent.dataTransfer; var files = dt.files; handleFiles(files); }); }); </code></pre> <p>php code: </p> <pre><code>&lt;?php if(isset($_FILES["files"])) { foreach ($_FILES["files"] as $file) echo $file['name']; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload