Dzint Posted August 17, 2006 Report Share Posted August 17, 2006 Nezinu ka lai veidoju vairaku failu uploadu. Izveidoju formu ar vairakiem input laukiem for ($sk=1;$sk<=2;$sk++) { echo "<tr><td><input type='file' name='files.{$sk}' value='Meklēt' size='80'></td></tr>"; Pec tame meginu uploadot: for ($ska=1;$ska<=2;$ska++) { $target_path = "img/"; $target_path = $target_path . basename( $_FILES['files.{$ska}']['name']); if(move_uploaded_file($_FILES['files.{$ska}']['tmp_name'], $target_path)) { echo "<br>Fails ". basename( $_FILES['files.{$ska}']['name']). " ir pievienot un ielādēts"; } else{ echo "<br>Mēģinot augšupielādēt failu radās kļūda, mēģiniet velreiz!"; } } Bet kautkas nestraada.Varbuut nav pareizi defineeti tie input lauka vardi(name). Link to comment Share on other sites More sharing options...
Toms Posted August 17, 2006 Report Share Posted August 17, 2006 (edited) Nelabi dari. <form method="post" action="" enctype="multipart/form-data"> <table border="1" cellpadding="1" cellspacing="0" class="gallery"> <tr> <td>Bilde:</td> <td><input type="file" name="bilde[]"/></td> </tr> <tr> <td>Bilde:</td> <td><input type="file" name="bilde[]"/></td> </tr> <tr> <td>Bilde:</td> <td><input type="file" name="bilde[]"/></td> </tr> <tr> <td>Bilde:</td> <td><input type="file" name="bilde[]"/></td> </tr> <tr> <td colspan="2" align="center"><br/><input type="submit" name="add_gallery" value="Pievienot"/></td> </tr> </table> </form> for ($x = 0; $x <= 3; $x++) { if ($_FILES['bilde']['error'][$x] != 4) { $dest = 'obj_gallery/small_'.$bilde; move_uploaded_file($_FILES['bilde']['tmp_name'][$x],$dest); } } Edited August 17, 2006 by Toms Link to comment Share on other sites More sharing options...
Dzint Posted August 17, 2006 Author Report Share Posted August 17, 2006 man nekas nenotiek tikai upload direktorija izveido failu Array Link to comment Share on other sites More sharing options...
Delfins Posted August 17, 2006 Report Share Posted August 17, 2006 Kljuda ir šeit: $_FILES['files.{$ska}'] Link to comment Share on other sites More sharing options...
Dzint Posted August 17, 2006 Author Report Share Posted August 17, 2006 Un ka tad japieraksta ta rinda Link to comment Share on other sites More sharing options...
Delfins Posted August 17, 2006 Report Share Posted August 17, 2006 RTFM sintaksi Link to comment Share on other sites More sharing options...
Kristabs Posted August 17, 2006 Report Share Posted August 17, 2006 Toms tak jau parādija. Link to comment Share on other sites More sharing options...
Recommended Posts