Друзья подскажите пожалуйста, есть неплохой скрипт мульти загрузки файлов, нужно после копирования на сервер их каждый переименовать, кто может, гляньте где ошибка, т.к. переименовывает только 1 файл, хотя в цикле все вроде ок. Заранее всем спасибо!!!
index.php:
CODE (htmlphp):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <script>
- function xdropFile(btn)
- {
- if(document.getElementById)
- {
- tr = btn;
- while (tr.tagName != 'TR') tr = tr.parentNode;
- tr.parentNode.removeChild(tr);
- checkForLast();
- }
- }
- function xaddFile(btn)
- {
- if(document.getElementById)
- {
- tr = btn;
- while (tr.tagName != 'TR') tr = tr.parentNode;
- var idSuffix = Math.round(Math.random()*1000);
- var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
- thisChilds = newTr.getElementsByTagName('td');
- for (var i = 0; i < thisChilds.length; i++)
- {
- if (thisChilds[i].className == 'header') thisChilds[i].innerHTML = '';
- if (thisChilds[i].className == 'files') thisChilds[i].innerHTML = '<input size="32" name="xtt[]" class="wideFile" type="file">';
- }
- checkForLast();
- }
- }
- function checkForLast()
- {
- btns = document.getElementsByName('xdrop');
- for (i = 0; i < btns.length; i++)
- {
- btns[i].disabled = (btns.length == 1) ? true : false;
- }
- }
- </script>
- <body>
- <form action="upload.php" method="post" name="form" ENCTYPE="multipart/form-data" align="center">
- <table width=20% align=center>
- <tr>
- <td width="20%"><input type="file" size="32" name="xtt[]"></td>
- <td nowrap="nowrap">
- <input type="button" name="xdrop" value=" −" onClick="xdropFile(this);">
- <input type="button" value=" + " onClick="xaddFile(this);">
- </td>
- </tr>
- </table>
- <input name="" type="submit">
- </form>
- </body>