rejetto forum

Author Topic: File upload with drag and drop  (Read 18452 times)

Offline mole

  • Occasional poster
  • *
  • Posts: 2
    • View Profile
Re: File upload with drag and drop
« on: January 28, 2015, 10:41:20 PM »
find:
Code: [Select]
xhr.onreadystatechange = function() {
                if (xhr.readyState == 4 && xhr.status == 200) {
                    //alert(file.name+" ok"); // handle response.  //xhr.responseText
                    var txt = document.createElement("div");
                    txt.innerHTML = "<a href='"+file.name+"'>"+file.name+"</a> ok "+file.size/1000+"kB"
                    document.querySelector('body').appendChild(txt);
                   
                }
            };
replace with:
Code: [Select]
      xhr.onreadystatechange = function() {
            if (xhr.readyState == 4 && xhr.status == 200) {
                //alert(file.name+" ok"); // handle response.  //xhr.responseText
                var txt = document.createElement("tr");
                txt.innerHTML = "<td><a href='" + file.name + "'>" + file.name + "</a></td><td>" + Math.ceil((file.size / 1000) * 100) / 100 + " KB</td><td> OK </td>"
                document.querySelector('tbody').appendChild(txt);

            }
        };
result:
« Last Edit: March 25, 2015, 09:57:14 PM by mole »

Follow members gave a thank to your post:


Thank-o-Matic 3.0 By Adk Team