limit my uploads with "php"

Status
Not open for further replies.

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
 

aneotoena

New Member
Messages
798
Reaction score
0
Points
0
just one question, where did you defined $uploaded_size? check how are you filling the variable
 

Fedlerner

Former Adm & Team Manager
Community Support
Messages
12,934
Reaction score
6
Points
38
You posted in the Spanish section.
Please post in the correct English section: "Site Management" or "Teh Intarwebz"

*Closed*
 
Status
Not open for further replies.
Top