Hi, I have the following code: browse.php <html> <head> <title>Form Upload</title> </head> <body> <? echo "<form method=\"post\" action=\"upload.php\" ENCTYPE=\"MULTIPART/FORM-DATA\">"; echo "<table> <tr> <td>Foto</td> <td><input type=\"FILE\" name=\"foto\"> </td> </tr> <tr> <td><input type=\"submit\" value=\"upload\"> <input type=\"reset\" value=\"reset\"> </td> </tr> </table></form>"; ?> </body> </html> After I press upload button, it will take me to the following code: upload.php <html> <head><title>Upload File</title></head> <body> <? echo "Ini adalah atribut \$foto = $foto"; echo "<br>"; echo "Ini adalah atribut \$foto_name = $foto_name"; echo "<br>"; echo "Ini adalah atribut \$foto_size = $foto_size"; echo "<br>"; echo "Ini adalah atribut \$foto_type = $foto_type"; copy ($foto, "../image/$foto_name"); ?> </body> </html> I expect it show me a page with no blanks, instead it gives the following: Ini adalah atribut $foto = Ini adalah atribut $foto_name = Ini adalah atribut $foto_size = Ini adalah atribut $foto_type = What should I add to the codes so that I have all the blanks filled-in?
Well for a start you are using register globals which is very bad. You should use the proper variables i.e: $_FILES['foto']['name']; $_FILES['foto']['size']; $_FILES['foto']['type']; $_FILES['foto']['tmp_name'];
EDIT: A few seconds too slow on the submit button... Use $_FILES['foto'] instead. Or do just: print_r($_FILES); PHP: