shaunNO2007
New Member
- Messages
- 57
- Reaction score
- 0
- Points
- 0
hi i need help with my php. to limit my users upload on my website. i have got a php code that should stop any text or php files but it does not i will put this code below so you no what am on about ) so if anyone know how to change it and make it work please help thanks
__________________________________________________ ______________________________________
------------------------------------------------------------------------------------------------------------------------------------
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
//This is our size condition
if ($uploaded_size > 7500000000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
die ( "PHP NO");
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
if ($ok=0)
{
echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
if ($ok=0)
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
__________________________________________________ ______________________________________
------------------------------------------------------------------------------------------------------------------------------------
ok thanks
shaun
__________________________________________________ ______________________________________
------------------------------------------------------------------------------------------------------------------------------------
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
//This is our size condition
if ($uploaded_size > 7500000000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
die ( "PHP NO");
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
if ($ok=0)
{
echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
if ($ok=0)
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
__________________________________________________ ______________________________________
------------------------------------------------------------------------------------------------------------------------------------
ok thanks
shaun