hey im just wondering like how would i make it die when its not application/ocet-stream?

$ip = $_SERVER['REMOTE_ADDR'];
$files = $_FILES["file"]["tmp_name"];
$file = rand(10,100) . $_FILES["file"]["name"];
if ((($_FILES["file"]["type"] == "application/octet-stream"))
&& ($_FILES["file"]["size"] < 400000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else

Recommended Answers

All 3 Replies

if ((($_FILES["file"]["type"] == "application/octet-stream"))
&& ($_FILES["file"]["size"] < 400000))
{
//do whatever you want... 
} else {
echo "The file you uploaded is not application/ocet-stream. Or the filesize is > 400000";
exit;
}

Cheers,
Naveen

thx but i would have to put alota code in the part beforethe else. like i have aloa if statements and inserting. BTW. how would i do the type by extension?

That must not be a problem. Eg.

if(variable1==condition1) {
   //check if variable1 satisfies condition2
   if(variable1==condition2) {
   //check if variable1 satisfies condition3
      if(variable1==condition3) {
      //variable1 satisfies condition1, condition2 and condition3
      } else if (variable1==condition4) {
       //variable1 satisfies condition1, condition2 and condition4 but not condition3
      } else {
            //variable1 doesnt satisfy condition3 and condition4, but satisfies only condition1 and condition2
      } 
   } else {
   //variable1 doesnt satisfy condition2,condition3 and condition4 but satisfies only condition1  
   }
} else {
   //variable1 doesnt satisfy condition1
}

And what do you mean by do the type by extension ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.