нашёл один хтмл/яваскрипт пример по мульти аттачу поковырял но не понял ка написать к нему форму которая файлы принимать будет... помогите плиз example.html HTML: <html> <head> <!-- Include the javascript --> <script src="multifile.js"></script> </head> <body> <!-- This is the form --> <form enctype="multipart/form-data" action="1.php" method = "post"> <!-- The file element -- NOTE: it has an ID --> <input id="my_file_element" type="file" name="file[]" > <input type="submit"> </form> Файлы: <!-- This is where the output will appear --> <div id="files_list"></div> <script> <!-- Create an instance of the multiSelector class, pass it the output target and the max number of files --> var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 3 ); <!-- Pass in the file element --> multi_selector.addElement( document.getElementById( 'my_file_element' ) ); </script> </body> </html> multifile.js [js]function MultiSelector( list_target, max ){ this.list_target = list_target; this.count = 0; this.id = 0; if( max ){ this.max = max; } else { this.max = -1; }; this.addElement = function( element ){ if( element.tagName == 'INPUT' && element.type == 'file' ){ element.name = 'file[]'; element.multi_selector = this; element.onchange = function(){ var new_element = document.createElement( 'input' ); new_element.type = 'file'; new_element.name = 'file[]'; this.parentNode.insertBefore( new_element, this ); this.multi_selector.addElement( new_element ); this.multi_selector.addListRow( this ); this.style.position = 'absolute'; this.style.left = '-1000px'; }; if( this.max != -1 && this.count >= this.max ){ element.disabled = true; }; this.count++; this.current_element = element; } else { alert( 'Error: not a file input element' ); }; }; this.addListRow = function( element ){ var new_row = document.createElement( 'div' ); var new_row_button = document.createElement( 'input' ); new_row_button.type = 'button'; new_row_button.value = 'Delete'; new_row.element = element; new_row_button.onclick= function(){ this.parentNode.element.parentNode.removeChild( this.parentNode.element ); this.parentNode.parentNode.removeChild( this.parentNode ); this.parentNode.element.multi_selector.count--; this.parentNode.element.multi_selector.current_element.disabled = false; return false; }; new_row.innerHTML = element.value; new_row.appendChild( new_row_button ); this.list_target.appendChild( new_row ); }; };[/js] помогите плиз :?
PHP: <?php // В PHP 4.1.0 и более ранних версиях следует использовать $HTTP_POST_FILES // вместо $_FILES. $uploaddir = '/var/www/uploads/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); print "<pre>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { print "File is valid, and was successfully uploaded. "; print "Here's some more debugging info:\n"; print_r($_FILES); } else { print "Possible file upload attack! Here's some debugging info:\n"; print "Possible file upload attack! Дополнительная отладочная информация:\n"; print_r($_FILES); } print "</pre>"; ?> Пойдет? Оригинал