Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] move_uploaded_file
-Gość-
post
Post #1





Goście







Czesc. probuje stworzyc skrypt do uploadu plikow... stosuje standardowy example z php.net:

  1. <?php
  2. echo '<pre>';
  3. if (move_uploaded_file($_FILES['userfile']['tmp_name'], './plik.txt')) {
  4. echo "File is valid, and was successfully uploaded.\n";
  5. } else {
  6. echo "Possible file upload attack!\n";
  7. }
  8.  
  9. echo 'Here is some more debugging info:';
  10. print_r($_FILES);
  11.  
  12. print "</pre>";
  13. ?>


skrypt zwraca:
Kod
Possible file upload attack!
Here is some more debugging info:Array
(
    [userfile] => Array
        (
            [name] => english.php
            [type] =>
            [tmp_name] =>
            [error] => 2
            [size] => 0
        )

)


Co jest nie tak? dlaczego tmp_name jest puste?

Kolejne pytanko, to kiedy klucz userfile zmienic moze sie na cos innego? np jak widzimy w innym examplu jest:"magfile"..

z gory tnx za pomoc,
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
-gox-
post
Post #2





Goście







aha, pytania nr. 2 nie bylo...

Kod
<form enctype="multipart/form-data" action="index.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />
</form>
Go to the top of the page
+Quote Post
-Gość-
post
Post #3





Goście







To co, wie ktos dlaczego ["tmp_name"] jest puste?questionmark.gif
Go to the top of the page
+Quote Post
Kicok
post
Post #4





Grupa: Zarejestrowani
Postów: 1 033
Pomógł: 125
Dołączył: 17.09.2005
Skąd: Żywiec

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


http://pl2.php.net/manual/en/features.file-upload.errors.php


--------------------
"Sumienie mam czyste, bo nieużywane."
Go to the top of the page
+Quote Post
-Gość-
post
Post #5





Goście







smile.gif dzieks
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: 21.08.2025 - 15:33