Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] nazwa wczytanego pliku jako zmienna, np wczytując fotke jej nazwa ma być zmienną
harbii
post 18.08.2006, 17:55:59
Post #1





Grupa: Zarejestrowani
Postów: 311
Pomógł: 1
Dołączył: 27.05.2006

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


Wczytuję (echo) na stronkę photo.php jakąś fotkę np fotka.jpg (lub inny plik jpg)
Chchiałbym aby nazwa pliku automatycznie została przypisana do zmiennej $plik
Jak tego dokonać?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
Cysiaczek
post 18.08.2006, 17:58:41
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




A jak wczytujesz ten obrazek? Przez <img src...> ?
Podaj więcej danych - najlepiej kod.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
harbii
post 18.08.2006, 18:06:55
Post #3





Grupa: Zarejestrowani
Postów: 311
Pomógł: 1
Dołączył: 27.05.2006

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


galeria.php. tu mam taki link
  1. <A HREF="foto.php?srodek=image/fotka.jpg" target="ImageWindow" style="text-decoration:none">


foto.php

  1. <?php
  2. echo '<img src="' . $_GET[ 'srodek' ] . '" />';
  3. ?>
Go to the top of the page
+Quote Post
-Wieviór-
post 18.08.2006, 18:08:10
Post #4





Goście







Cytat(harbii @ 18.08.2006, 19:06 ) *
  1. <?php
  2. $plik = $_GET[ 'srodek' ];
  3. ?>


?
Go to the top of the page
+Quote Post
harbii
post 18.08.2006, 18:28:08
Post #5





Grupa: Zarejestrowani
Postów: 311
Pomógł: 1
Dołączył: 27.05.2006

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


biggrin.gif
no tak. nie pomyślałem
jest jedno ale
ale pokazuje image/fotka.jpg
moża opciąć katalog aby została fotka.jpg albo najlepiej fotka?
Go to the top of the page
+Quote Post
Cysiaczek
post 18.08.2006, 18:42:28
Post #6





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Oczywiście.
http://www.php.net/manual/pl/function.basename.php


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
harbii
post 18.08.2006, 19:37:04
Post #7





Grupa: Zarejestrowani
Postów: 311
Pomógł: 1
Dołączył: 27.05.2006

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


ok.dzięki

dla zainteresowanych:
  1. <?php
  2. $path = $_GET[ 'srodek' ];
  3. $file = basename ($path);  
  4. $file = basename ($path, ".jpg");
  5. ?>

jest ok ale,
ja to zrobiłem tak:
  1. <?php
  2. $path = $_GET[ 'srodek' ];
  3. $file = basename ($path);  
  4. $tab = explode('.', $file);
  5. $nazwa = $tab[0];
  6. ?>


dzięki temu obcina wszystkie rozszerzenia

Ten post edytował harbii 18.08.2006, 19:37:54
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 Wersja Lo-Fi Aktualny czas: 13.08.2025 - 23:25