Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. if (eregi($var1, "^[0-9]{4}$")) {
    
    echo "yeah";
    
    } else {
    

     

    Well, I echo $var1 above this if statement, and it displays 1000. Which should match my statement? So I should end up echoing 'yeah' correct? It does everything in the else section. Not sure what's up :/

  2. [Tue Mar 17 11:04:24 2009] [error] [client 70.155.67.57] PHP Warning:  POST Content-Length of 17461421 bytes exceeds the limit of 8388608 bytes in Unknown on line 0, referer: https://www.berryequipment.net/videos/post/

     

     

    I'm receiving this error, I'm obviously trying to upload 16MB and my current limit is 8MB. I went in to my php.ini file and changed to this:

    ; Maximum size of POST data that PHP will accept.

    post_max_size = 60M

     

    Is there somewhere else something needs to be set that I am missing? Not really sure where to look to get this limit raised.

  3. Okay I threw that in there, sorry it took so long, I was out of work yesterday. Anyways, here is what I have now:

     

    
    <?php
    session_start();
    header("Cache-control: private");
    if(!isset($_SESSION["id"]))
    {
    header("Location: /login/");
    }
    
    
    
    if(isset($_POST["submit"])) {
    
    
    $file = $_FILES['userfile'];
    
    $allowedExtensions = array("avi", "mov", "mp4", "mpg", "mpeg", "wmv");
    
    function isAllowedExtension($fileName) {
      global $allowedExtensions;
    
    
      return in_array(end(explode(".", $fileName)), $allowedExtensions);
      print_r(explode(".", $fileName));
      echo end(explode(".", $fileName));
      return in_array(end(explode(".", $fileName)), $allowedExtensions);
    
    }
    
    if($file['error'] == UPLOAD_ERR_OK) {
      if(isAllowedExtension($file['name'])) {
        if (move_uploaded_file ($_FILES['file']['tmp_name'], "upload/{$_FILES['file']['name']}")) {
    echo "Has been uploaded";
    } else {
    
    echo "Not uploaded:<br />";
    
    print "$_FILES[file][error]";
    
    
    }
    
      } else {
        echo "Invalid file type";
      }
    } else die("Cannot upload");
    
    
    
    
    
    }
    
    
    
    
    
    if ($var1 == post){
    $content .= '
    <form action="/videos/post/" method="post"
    enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="62914560" />
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="submit" value="Post Video" />
    </form>
    ';
    }
    
    
    
    ?>
    

     

    Displaying just one error : Invalid file type 

  4. The following code is not allowing me to upload any files at all, it returns: Invalid file type.

    Any help please?

    
    <?php
    session_start();
    header("Cache-control: private");
    if(!isset($_SESSION["id"]))
    {
    header("Location: /login/");
    }
    
    
    
    if(isset($_POST["submit"])) {
    
    
    $file = $_FILES['userfile'];
    
    $allowedExtensions = array("avi", "mov", "mp4", "mpg", "mpeg", "wmv");
    
    function isAllowedExtension($fileName) {
      global $allowedExtensions;
    
      return in_array(end(explode(".", $fileName)), $allowedExtensions);
    }
    
    if($file['error'] == UPLOAD_ERR_OK) {
      if(isAllowedExtension($file['name'])) {
        if (move_uploaded_file ($_FILES['file']['tmp_name'], "upload/{$_FILES['file']['name']}")) {
    echo "Has been uploaded";
    } else {
    
    echo "Not uploaded:<br />";
    
    print "$_FILES[file][error]";
    
    
    }
    
      } else {
        echo "Invalid file type";
      }
    } else die("Cannot upload");
    
    
    
    
    
    }
    
    
    
    
    
    if ($var1 == post){
    $content .= '
    <form action="/videos/post/" method="post"
    enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="62914560" />
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="submit" value="Post Video" />
    </form>
    ';
    }
    
    
    
    ?>
    

  5. it wont even let me concatenate things to the end of the variable

    ?

     

    Just changed it to match up with that,

    if(isset($_POST["submit"])) {
    
    $target_path = "upload/";
    
    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
    
    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        echo "The file ".  basename( $_FILES['uploadedfile']['name']).
        " has been uploaded";
    } else{
        echo "There was an error uploading the file, please try again!";
    }
    
    
    }
    

    and

    There was an error uploading the file, please try again! 

     

  6. <?php
    session_start();
    header("Cache-control: private");
    if(!isset($_SESSION["id"]))
    {
    header("Location: /login/");
    }
    
    
    
    if(isset($_POST["submit"])) {
    
    if (move_uploaded_file ($_FILES['thefile']['tmp_name'], "upload/{$_FILES['thefile']['name']}")) {
    echo "Has been uploaded";
    } else {
    
    echo "Not uploaded:<br />";
    
    print "$_FILES[thefile][error]";
    
    
    }
    
    
    
    }
    
    
    
    
    
    if ($var1 == post){
    $content .= '
    <form action="/videos/post/" method="post"
    enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="62914560" />
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="submit" value="Post Video" />
    </form>
    ';
    }
    
    
    
    ?>
    
    

     

    Okay, so far I am just trying to upload a small jpg and have it moved to my upload folder. With what code I have, this is echo'd out:

    Not uploaded:

    [error]

     

     

     

     

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.