/usr/share/php/doc/HTTP_Upload/docs/upload_example.php is in php-http-upload 1.0.0b1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | <html><body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>?submit=1" method="post" enctype="multipart/form-data">
Send these files:<br>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<input name="userfile" type="file"> <-<br>
<input name="otherfile[]" type="file"><br>
<input name="otherfile[]" type="file"><br>
<input type="submit" value="Send files">
</form>
</body></html>
<?php
error_reporting(E_ALL);
if (!isset($_GET["submit"])) {
exit;
}
require 'HTTP/Upload.php';
echo '<pre>';
$upload = new http_upload('es');
$file = $upload->getFiles('userfile');
if (PEAR::isError($file)) {
die ($file->getMessage());
}
if ($file->isValid()) {
$file->setName('uniq');
$dest_dir = './uploads/';
$dest_name = $file->moveTo($dest_dir);
if (PEAR::isError($dest_name)) {
die ($dest_name->getMessage());
}
$real = $file->getProp('real');
echo "Uploaded $real as $dest_name in $dest_dir\n";
} elseif ($file->isMissing()) {
echo "No file selected\n";
} elseif ($file->isError()) {
echo $file->errorMsg() . "\n";
}
print_r($file->getProp());
echo '</pre>';
?>
|