Hi All,
New to the forums coz I havent been able to find any one who can help me with my current issue.
the problem is I cannot upload files through a form on a OpenBSD 3.6 machine running php 4.3.0 and mysql.
I have tested this form on my laptop which has apache2 and php and mysql also and it works without question straight away.
as for the server I receive a notice of undefined index: userfile and it appears that the file isnt at all passed to the script, but I could be wrong.
I will paste the code below for both the form and the php code.
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
if(isset($_POST['submit']) || count($_FILES) > 0)
{
$uploaddir = './htdocs/sites/APSmambo/public_html/images/';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
echo "File is valid, and was successfully uploaded.\n";
}
else
{
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
}
?>
<HTML>
<form enctype="multipart/form-data" method="POST" action ="<?php echo $_SERVER['PHP_SELF']; ?>">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="300000000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" name="submit" value="Send File" />
</form>
</HTML>
I may have this posted in the wrong section and if so could a mod please move it to the appropriate area, I only posted here because the code works so to me it is something other then the code.....
Any help would be greatly appreciated, thank in advance to all who help.