+ <?php
+ }
+
+ if ($settings['allow_external_refs']) {
+ ?>
+ <a href="https://github.com/muchweb/simple-php-upload" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
+ <?php
+ } else {
+ ?>
+ <a href="https://github.com/muchweb/simple-php-upload" target="_blank">Fork me on GitHub</a>
+ <?php
+ }
+ ?>
+ <script type="text/javascript">
+ <!--
+ var target_form = document.getElementById('simpleupload-form'),
+ target_ul = document.getElementById('simpleupload-ul'),
+ target_input = document.getElementById('simpleupload-input');
+
+ target_form.addEventListener('dragover', function (event) {
+ event.preventDefault();
+ }, false);
+
+ function AddFileLi (name, info) {
+ target_form.style.display = 'none';
+
+ var new_li = document.createElement('li');
+ new_li.className = 'uploading';
+
+ var new_a = document.createElement('a');
+ new_a.innerHTML = name;
+ new_li.appendChild(new_a);
+
+ var new_span = document.createElement('span');
+ new_span.innerHTML = info;
+ new_a.appendChild(new_span);
+
+ target_ul.insertBefore(new_li, target_ul.firstChild);
+ }
+
+ function HandleFiles (event) {
+ event.preventDefault();
+
+ var i = 0,
+ files = event.dataTransfer.files,
+ len = files.length;
+
+ var form = new FormData();
+
+ for (; i < len; i++) {
+ form.append('file[]', files[i]);
+ AddFileLi(files[i].name, files[i].size + ' bytes');
+ }
+
+ var xhr = new XMLHttpRequest();
+ xhr.onload = function() {
+ window.location.reload();
+ };
+
+ xhr.open('post', '<?php echo $data['scriptname']; ?>', true);
+ xhr.send(form);
+ }
+
+ target_form.addEventListener('drop', HandleFiles, false);
+
+ document.getElementById('simpleupload-input').onchange = function () {
+ AddFileLi('Uploading...', '');
+ target_form.submit();