I'm trying to upload files through a php script. Although all the files I tried wouldnt work.
I wrote this little script to try and find out what was wrong:
<?
if(isset($HTTP_POST_VARS['submit'])) {
// get post vars
$file = $HTTP_POST_FILES['userfile']['tmp_name'];
$filename = $HTTP_POST_FILES['userfile']['name'];
$filetype = $HTTP_POST_FILES['userfile']['type'];
$filesize = $HTTP_POST_FILES['userfile']['size'];
echo("File: $file<br>");
echo("Filename: $filename<br>");
echo("Filetype: $filetype<br>");
echo("Filesize: $filesize<br>");
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>Untitled</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="userfile">
<input type="submit" name="submit" value="Upload">
</form>
</body>
It worked fine locally. When I tried on my server any files over 4k said they had a file size of 0. While under 4k seemed to work ok. Can anyone help me out here.
Thanks
😃