Pour télécharger un fichier vers le serveur en utilisant PHP, utilisez le code ci-dessous.
file_upload.php
<HTML>
<HEAD>
<TITLE> Example Upload Form upload.phtml </TITLE>
<BODY>
<?php
if ( $userfile )
{
@$res=copy($userfile,"$userfile_name");
if ( !$res )
print "Upload failed! \n";
else
print "Upload of $userfile_name successful \n";
}
?>
<FORM method=POST ENCTYPE="multipart/form-data">
File to Upload
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="5000000">
<INPUT NAME="userfile" TYPE="file" size=35>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>