index.html:
--------------
Código PHP:
<form action="../upload/files.php" METHOD="post" enctype="multipart/form-data">
------------------
Código PHP:
<?php
require '../upload/upload.php';
$upload = new HTTP_Upload('es'); // Language for error messages
$file = $upload->getFiles('userfile'); // return a file object or error
if (PEAR::isError($file)) {
die ($file->getMessage());
}
// Check if the file is a valid upload
if ($file->isValid()) {
// this method will return the name of the file you moved,
// useful for example to save the name in a database
$file_name = $file->moveTo('../upload/fotos/');
if (PEAR::isError($file_name)) {
die ($file_name->getMessage());
}
}
?>