A
Anonymous
Guest
Hi guys,
can somebody give me an idea what have i done wrong ??? it displayed "Error : Possible file upload error" as my output..
my code:
<head>
<title>
Uploading ....
</title>
</head>
<body>
<h1> Uploading file .. </h1>
<?
if($userfile == "none")
{
echo 'Error : No file uploaded ';
exit;
}
if($usefile_size == 0)
{
echo 'Error : Uploaded file is zero lenght';
exit;
}
if($usefile_type != "image/gif")
{
echo 'Error : Incompatible file detected';
exit;
}
if(!is_uploaded_file($userfile))
{
echo 'Error : Possible file upload error';
exit;
}
$upfile = $userfile_name;
if(!copy($userfile, $upfile))
{
echo 'Error : Could not copy the file';
exit;
}
echo "File uploaded <br><br>";
$fp = fopen($upfile,"r");
$content = fread($fp, filesize ($upfile));
fclose($fp);
$contents = strip_tags($contents);
$fp = fopen($upfile, "w");
fwrite($fp, $contents);
fclose($fp);
echo "preview of uploaded file contents: <br><hr>";
echo $contents;
echo "<br><hr>";
?>
</body>
everything looks okay for me but why i still get this error when i upload gif file.. i have changed to text/plain and upload text file but error still occured (display "Error:Incompatible file detected") My code just doesn't work at all...
is there any website i can go to refer to what i suppose to use when i wanna upload a word doc, excel file and etc .. (i mean like image/jpeg , text/,,,, )
hope you guys may able to help me.
please advise.
can somebody give me an idea what have i done wrong ??? it displayed "Error : Possible file upload error" as my output..
my code:
<head>
<title>
Uploading ....
</title>
</head>
<body>
<h1> Uploading file .. </h1>
<?
if($userfile == "none")
{
echo 'Error : No file uploaded ';
exit;
}
if($usefile_size == 0)
{
echo 'Error : Uploaded file is zero lenght';
exit;
}
if($usefile_type != "image/gif")
{
echo 'Error : Incompatible file detected';
exit;
}
if(!is_uploaded_file($userfile))
{
echo 'Error : Possible file upload error';
exit;
}
$upfile = $userfile_name;
if(!copy($userfile, $upfile))
{
echo 'Error : Could not copy the file';
exit;
}
echo "File uploaded <br><br>";
$fp = fopen($upfile,"r");
$content = fread($fp, filesize ($upfile));
fclose($fp);
$contents = strip_tags($contents);
$fp = fopen($upfile, "w");
fwrite($fp, $contents);
fclose($fp);
echo "preview of uploaded file contents: <br><hr>";
echo $contents;
echo "<br><hr>";
?>
</body>
everything looks okay for me but why i still get this error when i upload gif file.. i have changed to text/plain and upload text file but error still occured (display "Error:Incompatible file detected") My code just doesn't work at all...
is there any website i can go to refer to what i suppose to use when i wanna upload a word doc, excel file and etc .. (i mean like image/jpeg , text/,,,, )
hope you guys may able to help me.
please advise.