|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-04-25 12:26 UTC] rasmus@php.net
[2001-04-25 12:27 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 02:00:01 2025 UTC |
<HTML> <BODY> <?php define(MAX_SIZE, 1000000); define(UPLOAD, 0); define(SUBMIT, 1); function upload() { global $PHP_SELF; printf ("<form method=\"post\" ENCTYPE=\"multipart/form-data\" action=\"%s?action=%d&person_id=%d\">\n", $PHP_SELF,SUBMIT,$person_id); print ("File:<BR> <INPUT TYPE=FILE NAME=\"pictfile\" SIZE=50><BR>"); print ("<input type=\"submit\" name=\"button\">\n"); printf ("</form>\n"); } function submit($file) { $fd=fopen($file,"r") or die ("Unable to open uploaded file!"); $data=fread($fd, MAX_SIZE); fclose($fd); unlink($file); echo "Beginning of file: ".substr($data, 0, 25); } if (empty($action)) $action = UPLOAD; switch ($action) { case UPLOAD: upload(); break; case SUBMIT: submit($pictfile); break; default: die ("Unknown action code ($action)"); } ?> </body> </html>