PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
//file upload
$target = "../uploads/sitefolders/";
$target2 = time();
$target3 = basename( $_FILES['uploaded']['name']);
$rel1 = substr($target3, -3);
$target = $target . $target2 . "." .$rel1 ;
$ok=1;
//This is our size condition
if ($uploaded_size > 350000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
elseif ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
elseif ($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))
{
?>
<script>alert("okk");</script>
<?php
// echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
//header("location:index.php");
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}