note 19159 deleted from function.copy by alindeman

From: Date: Fri, 09 May 2003 22:15:09 +0000
Subject: note 19159 deleted from function.copy by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-47788@lists.php.net to get a copy of this message
// The easiest way to upload/copy a file to the server <HTML> <TITLE> File upload </title> <body> <B>File upload</b><BR><BR> <form enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>" method="post"> <!-- "MAX_FILE_SIZE" determines the biggest size an uploaded file can occupy --> <input type="hidden" name="MAX_FILE_SIZE" value="500000"> Send this file: <input name="userfile" type="file"> <input type="submit" name="submit" value="Send File"> </form> </body> <?PHP /* $userfile - The temporary filename in which the uploaded file was stored on the server machine. $userfile_name - The original name or path of the file on the sender's system. $userfile_size - The size of the uploaded file in bytes. $userfile_type - The mime type of the file if the browser provided this information. An example would be "image/gif". */ // copy to this directory $dir="./bor/"; // copy the file to the server if (isset($submit)){ copy($userfile,$dir.$userfile_name); if (!is_uploaded_file ($userfile)){ echo "<BR> <b>$userfile_name</b> couldn't be copied !!"; } } // check whether it has been uploaded if (is_uploaded_file ($userfile)){ echo "<BR> <b>$userfile_name</b> copied succesfully !!"; } ?> </html>

« previous php.notes (#47788) next »