-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> bool move_uploaded_file ( string filename, string destination)
>
> If filename is not a valid upload file, then no action will occur, and > move_uploaded_file() will return FALSE.
>
> If filename is a valid upload file, but cannot be moved for some > reason, no action will occur, and move_uploaded_file() will return > FALSE. Additionally, a warning will be issued."




i would echo $_FILES['userfile']['tmp_name'] and check if that folder from that path exists
if it doesnt exist, check php.ini, maybe temp dir for upload is set wrong...





Adwinwijaya wrote:
Hello php-general,

  Right now I am trying to create a form that upload the file.
  The form it self:

  <form name="forms2" action="upload.php" method="post" enctype="multipart/form-data">
        <input type="hidden" name="MAX_FILE_SIZE" value="64000">
        <input name="image" type="file">
        <input type="submit" name="submit">
  </form>

  and the upload.php itself contain the code that I took from chapter
  18 of php manual:

<?php

$uploaddir = 'C:/Program Files/Apache Group/Apache2/htdocs/test/' ;
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>" ; ?>



But, I always got:


Possible file upload attack!  Here's some debugging info:
Array
(
    [image] => Array
        (
            [name] => templates.txt
            [type] => text/plain
            [tmp_name] => C:\WINDOWS\TEMP\php471.tmp
            [error] => 0
            [size] => 2048
        )

)

and when I look up at C:/Program Files/Apache
Group/Apache2/htdocs/test/ (the target directory) ..  I never found
the file that I uploaded ...

can someone tell me y this happen ?

thank you

--
Best regards,
 adwinwijaya                          mailto:[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAOwPZaxdA/5C8vH8RAjrsAKDTeIJ/2IzExUiX8qwbZiQIDSMYYQCfT63J
ZwVkqmvuiOAshWqpHGRx6xM=
=5pB5
-----END PGP SIGNATURE-----

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to