+ Reply to Thread
Results 1 to 2 of 2

Thread: limit my uploads with "php" help me

  1. #1
    shaunNO2007's Avatar
    shaunNO2007 is offline x10Hosting Member shaunNO2007 is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    57

    limit my uploads with "php" help me

    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

  2. #2
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: limit my uploads with "php" help me

    Check the extension instead of the mime type.

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


+ Reply to Thread

Similar Threads

  1. limit my uploads with "php" help me
    By shaunNO2007 in forum Feedback and Suggestions
    Replies: 0
    Last Post: 11-23-2007, 12:14 PM
  2. limit my uploads with "php"
    By shaunNO2007 in forum Introductions
    Replies: 0
    Last Post: 11-22-2007, 05:21 PM
  3. limit my uploads with "php"
    By shaunNO2007 in forum General
    Replies: 2
    Last Post: 11-22-2007, 04:16 PM
  4. File Size Limit
    By eagleeyed in forum Free Hosting
    Replies: 8
    Last Post: 10-23-2006, 06:46 AM
  5. Upload file size limit
    By funindia in forum Free Hosting
    Replies: 0
    Last Post: 06-05-2005, 01:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers