Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Upload plików i uprawnienia
Dukov
post 10.12.2018, 21:01:48
Post #1





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 21.03.2017

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


Dzień dobyr, wywala mi taki błąd
Warning: move_uploaded_file(/var/www/html/frontend/images/avatars/test.jpg): failed to open stream: Permission denied in /var/www/html/backend/get_file.php on line 15

Warning: move_uploaded_file(): Unable to move '/tmp/phpkh8IJH' to '/var/www/html/frontend/images/avatars/test.jpg' in /var/www/html/backend/get_file.php on line 15
Uprawnienia mam ustawione na 777 do wszystkich plików i katalogów na localhoście i nie bardzo wiem co jeszcze mogę wiecej z tym zrobić.
Go to the top of the page
+Quote Post
mrk9109
post 11.12.2018, 04:52:50
Post #2





Grupa: Zarejestrowani
Postów: 445
Pomógł: 3
Dołączył: 4.06.2010

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


Pokaz kod
Go to the top of the page
+Quote Post
Pyton_000
post 11.12.2018, 08:01:39
Post #3





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

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


pokaż wynik:

Kod
ls -ld /var/www/html/frontend/images/avatars
Go to the top of the page
+Quote Post
Dukov
post 11.12.2018, 08:31:44
Post #4





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 21.03.2017

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


  1. <?php
  2. error_reporting(E_ALL); // or E_STRICT
  3. ini_set("display_errors",1);
  4. ini_set("memory_limit","1024M");
  5. print_r($_FILES);
  6. $max_size = 1600*1200;
  7. $check;
  8. if (is_uploaded_file($_FILES['file']['tmp_name'])) {
  9. if ($_FILES['file']['size'] > $max_size) {
  10. echo 'Błąd! Plik jest za duży!';
  11. } else {
  12. if (isset($_FILES['file']['type'])) {
  13. if($_FILES['file']['type'] == 'image/png' && $_FILES['file']['type'] == 'image/jpeg'&& $_FILES['file']['type'] == 'image/gif')
  14. move_uploaded_file($_FILES['file']['tmp_name'],$_SERVER['DOCUMENT_ROOT'].'/frontend/images/avatars/test.jpg');
  15.  
  16.  
  17. }
  18.  
  19. }
  20. } else {
  21. echo 'Błąd przy przesyłaniu danych!';
  22. }

i wynik drwxrwxrwx. 2 adam adam 4096 12-10 20:11 /var/www/html/frontend/images/avatars

Go to the top of the page
+Quote Post
prz3kus
post 11.12.2018, 09:52:51
Post #5





Grupa: Zarejestrowani
Postów: 260
Pomógł: 30
Dołączył: 22.01.2007

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


https://stackoverflow.com/questions/9133024...ata-permissions
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: 28.03.2024 - 19:14