Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] katalogi i pliki
albercik1983
post
Post #1





Grupa: Zarejestrowani
Postów: 37
Pomógł: 0
Dołączył: 28.02.2009

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


Witam.
Mam problem z utworzeniem katalogu w istniejacym już katalogu "user".

Jeśli dam:

mkdir($_POST['login']);
fopen (user.php, a);

tworzy katalog o nazwie zmiennej i plik userphp (bez kropki ;/) w katalogu głównym.
Teraz jeśli chcę aby folder o nazwie zmiennej został stworzony w istniejącym katalogu "user" to daję:

mkdir(user/$_POST['login']);
fopen (user/$_POST['login']/user.txt, a);

to wyskakuje błąd:
Warning: mkdir() [function.mkdir]: File exists
Warning: Division by zero

jeśli dam:
mkdir(../user/$_POST['login']);
fopen (../user/$_POST['login']/user.txt, a);
to mam błąd:
Parse error: parse error, unexpected '.', expecting ')'

Ktoś wie jak to rozwiązać?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
patryk20120
post
Post #2





Grupa: Zarejestrowani
Postów: 256
Pomógł: 1
Dołączył: 20.04.2008

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


To powinno działać (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
  1. <?php
  2. mkdir ("user/".$_POST['login'], 0700);
  3. fopen('user/'.$_POST['login'].'/text.txt', 'a');
  4. ?>
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 2.10.2025 - 21:58