Hello guys
This is my first post to the list, hope you can give point me to the right
direction.
Well, I've been trying to upload a file without much success so far.
All I get is my firs error message: "There is no file to send" (shown in the
script).
This is my form:
<form enctype="multipart/form-data" name="book_add" method="post"
action=".$PHP_SELF."?management=5>
<input type="hidden" name="MAX_FILE_SIZE" value="2000">
<table width="100%" border="0" bgcolor="#CCCCCC">
<tr>
<td width="51%">Book Name:</td>
<td width="49%"><input type="text" name="form_title" size="40"></td>
</tr>
<tr>
<td width="51%">File:</td>
<td width="49%"><input type="file" name="formfile"></td>
</tr>
<tr align="center">
<td width="51%"><input type="reset" name="reset" value="Clean"></td>
<td width="49%"><input type="submit" name="submit" value="Add new book"></td>
</tr>
</table>
</form>
And this is the script that handles the data:
if ($formfile == "none")
{
echo "There is no file to send";
exit;
}
if ($formfile_size == 0)
{
echo "Bad file size";
exit;
}
if ($formfile_type != "application/pdf")
{
echo "Non a PDF file";
exit;
}
if (!is_uploaded_file($formfile))
{
echo "Warning!!!";
exit;
}
$upfile = "/var/www/bva/new/pdf/".$formfile_name;
if (!copy($formfile, $upfile))
{
echo "There was a problem moving the file to the repository";
exit;
}
else
{
echo "New book has been uploaded";
exit;
}
Thanks a lot for your help.
*******************************************************
Wilmar P�rez
Network Administrator
Library System
Tel: ++57(4)2105145
University of Antioquia
Medell�n - Colombia
2002
*******************************************************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php