Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: upload 4 plikow graficznych
Forum PHP.pl > Forum > Przedszkole
trucksweb
napisalem skrypt ktory uploaduje 4 pliki graficzne. Tzn. zrobilem ze uploaduje 1 bo nie wiem jak zmienic kod php zeby robil 4 pliki a nie tylko jeden z formularza.

mam 2 pliki:
dodaj.htm w ktorym jest formluarz uploadu 4 zdjec
  1. <div align="center">
  2. <br>
  3. <br>
  4. <br>
  5. <form name="form1" method="post" action="sprawdz.php" enctype="multipart/form-data">
  6.  
  7.  
  8. <table border="0" width="403" cellspacing="0" cellpadding="0">
  9. <tr>
  10. <td width="387" height="50" valign="middle" class="form" ><strong>Opis zdjęcia:
  11. </strong>
  12. <p>
  13. <p class="style1">Jego treść opublikowana będzie pod obrazkiem.</td>
  14.  
  15. <td width="287" height="50" align="center" class="form">
  16. <p align="center"><textarea rows="3" name="image_opis" cols="30" id="item_opis" type"text" ></textarea></td>
  17. </tr>
  18.  
  19. <tr>
  20. <td width="387" height="38" class="form2"><strong>Nazwa firmy:</strong></td>
  21. <td width="287" height="38" align="center" class="form2"><input type="text" name="image_uzytkownik" id="image_uzytkownik" size="27">
  22.  
  23. </td>
  24. </tr>
  25. <tr>
  26. <td width="387" height="60" class="form"><strong>Wybierz zdjęcie:</strong></td>
  27. <td width="287" height="60" align="center"><input name="image_filename" type="file" id="image_filename"></td>
  28. </tr>
  29. <tr>
  30. <td width="387" height="15" colspan="2"></td>
  31. </tr>
  32. <tr>
  33. <td width="387" height="50" valign="middle" class="form2"><strong>Opis zdjęcia:
  34. </strong> <p>
  35. <p class="style1">Jego treść opublikowana będzie pod obrazkiem.</td>
  36. <td width="287" height="50" align="center" class="form2">
  37.  
  38. <p align="center"><textarea rows="3" name="image_opis" cols="30" id="image_opis" type"text" ></textarea></td>
  39. </tr>
  40. <tr>
  41. <td width="387" height="60"><strong>Wybierz zdjęcie:</strong></td>
  42. <td width="287" height="60" align="center" class="form"><input name="image_filename" type="file" id="image_filename"></td>
  43. </tr>
  44. <tr>
  45. <td width="387" height="34" colspan="2"></td>
  46. </tr>
  47. <tr>
  48. <td width="387" height="50" class="form2"><strong>Opis zdjęcia:</strong>
  49. <p>
  50. <p class="style1">Jego treść opublikowana będzie pod obrazkiem.</td>
  51. <td width="287" height="50" align="center" class="form2">
  52.  
  53. <p align="center"><textarea rows="3" name="image_opis" cols="30" id="image_opis" type"text" ></textarea></td>
  54. </tr>
  55. <tr>
  56. <td width="387" height="60" class="form"><strong>Wybierz zdjęcie:</strong></td>
  57. <td width="287" height="60" align="center" class="form"><input name="image_filename" type="file" id="image_filename" ></td>
  58. </tr>
  59. <tr>
  60. <td width="387" height="29" colspan="2"></td>
  61. </tr>
  62. <tr>
  63. <td width="387" height="50" valign="middle" class="form2"><strong>Opis zdjęcia:</strong> <p>
  64. <p class="style1">Jego treść opublikowana będzie pod obrazkiem.</td>
  65. <td width="287" height="50" align="center" class="form2">
  66.  
  67. <p align="center"><textarea rows="3" name="image_opis" cols="30" id="image_opis" type"text" ></textarea></td>
  68. </tr>
  69. <tr>
  70. <td width="387" height="60" class="form" ><strong>Wybierz zdjęcie</strong>:</td>
  71. <td width="287" height="60" align="center" class="form"><input name="image_filename" type="file" id="image_filename" ></td>
  72. </tr>
  73. <tr>
  74. <td height="48" colspan="2" align="right"><input type="submit" name="Submit" value="Wyślij">
  75. <input type="reset" name="Submit2" value="Kasuj"></td>
  76. </tr>
  77. <tr align="center">
  78. <td height="33" colspan="2" class="form2" align="center">Przyjmowane są zdjęcia w formacie: GIF, JPG/JPEG, PNG, których waga nie przekrasza <strong>400 kb</strong> </td>
  79. </tr>
  80. <tr>
  81. <td width="387" height="53"></td>
  82. <td width="287" height="53"></td>
  83. </tr>
  84. </table>
  85. </form>
  86. </center>
  87. </div>




czy ktos moglby powiedziec jak zrobic zeby przsylal wiecej niz jeden plik questionmark.gif
worriedsmiley.gif
mike
Było wiele razy na forum.
Użyj tablicy:
  1. <input name="image_filename[]" type="file" id="image_filename_1">
  2. <input name="image_filename[]" type="file" id="image_filename_2">
  3. <input name="image_filename[]" type="file" id="image_filename_3">
  4. <input name="image_filename[]" type="file" id="image_filename_4">
trucksweb
no to do dodaj.htm do formularza a jak w php zrobic zeby bral z tych 4 inputow questionmark.gif
revyag
RTFM snitch.gif
manual/pl/features.file-upload.multiple.php
mike
No weś mnie nie osłabiaj tongue.gif
Nie potrafisz pętlą po tablicy przejść laugh.gif
Zobacz sobie co przychodzi:
  1. <?php
  2.  
  3. echo '<pre>' . print_r( $_FILES, true ) . '</pre>';
  4.  
  5. ?>

I skorzystaj z foreach

I jeszcze tamat na Pro. walnąłeś.
Chcesz żeby mi przepona ze śmiechu wysiadła :?:

Przenoszę na php Pocz.
trucksweb
problem rozwiazny tongue.gif
dzieki mike_mech
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.