Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] [HTML] [SQL] ładowanie grafik
poniedzialek
post
Post #1





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 11.01.2006

Ostrzeżenie: (0%)
-----


witam
prosilbym o info jak zrobic cos takiego zeby strona pobrala obrazek wskazany z hdd skopiowala go na serwer i wpisala jego nazwe do bazy
z gory dzieki

Ten post edytował poniedzialek 4.04.2006, 12:00:09
Go to the top of the page
+Quote Post
SirK
post
Post #2





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 27.05.2005

Ostrzeżenie: (0%)
-----


Moze to Ci pomoze:

Plik formularza:
  1. <?php
  2.  
  3. <form action='dodaj.php'>
  4. Zdjęcie 1: <input type="file" name="thefiles[]"/>
  5. Zdjęcie 2: <input type="file" name="thefiles[]"/>
  6. </form>
  7.  
  8. ?>


Plik dodaj.php:
  1. <?php
  2.  
  3.  
  4.  $n = 0;
  5.  $aBasePath = dirname( $PATH_TRANSLATED );
  6. for ( $nIndex = 0; $nIndex < count( $thefiles ); $nIndex++ )
  7. {
  8. if ( !empty( $thefiles_name[$nIndex] ) )
  9. {
  10. $aType = $thefiles_type[$nIndex];
  11. if ( ( $aType == "image/gif" ) ||
  12. ( $aType == "image/pjpeg" ) ||
  13. ( $aType == "image/jpeg" ) )
  14. {
  15. $n = $n + 1;
  16.  
  17.  $nazwa_pliku = "NAZWA PLIKU". $n . "-" . $thefiles_name[$nIndex];
  18.  $aNewName = $aBasePath . "/images/" .$nazwa_pliku;
  19.  copy( $thefiles[$nIndex], $aNewName );
  20.  
  21.  
  22.  $aNewNames[] = $thefiles_name[$nIndex];
  23.  
  24.  
  25. }
  26. }
  27. }
  28.  
  29. }
  30.  
  31.  
  32.  
  33. ?>


--------------------
Zapraszam:
Noclegi w Polsce
Sylwester 2006/2007 - oferty sylwestrowe
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 04:41