PHP $_FILES upload timeout on large files.

Discussion in 'PHP' started by advancedfuture, Jan 18, 2008.

  1. #1
    I have editted my php.ini file to allow the following:

    Max memory used: 300M
    Max Upload Size: 300M

    I also set my upload script to never timeout as shown in my sourcecode below... Yet for some reason it doesn't always except the file... and many times if the file is over 7mb it tries for a minute then executes the else statement and gives me the "Error" message..

    Am I going about this the right way?

    
    <?php
    
    echo '<form action="videoUpload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <input name="ufile" type="file" id="ufile" size="50" />
    <input type="submit" name="submit" value="Upload" />
    </form>';
    
    if($_POST['submit'])
    {
    	set_time_limit(0);
    	$sourcefile = $_FILES['ufile']['tmp_name'];
    	$destfile = md5(uniqid(rand(), true));
    	$path = "upload/".$destfile;
    
    	copy($sourcefile, $path);
    	//$newname = md5(uniqid(rand(), true)).".flv";
    	//$exec = "ffmpeg -i upload\\".$destfile." -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 upload\\".$newname;
    	//exec($exec);
    }
    
    else
    {
    	echo "Error Uploading Video File";
    }
    
    //unlink($path);
    ?>
    
    Code (markup):
     
    advancedfuture, Jan 18, 2008 IP
  2. SecureWebDev

    SecureWebDev Active Member

    Messages:
    677
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    80
    #2
    nvm already have it there
     
    SecureWebDev, Jan 18, 2008 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    If it is giving you the error:

    echo "Error Uploading Video File";

    Then it is not even going to the forum $_POST['submit'] is not set, true:

    if($_POST['submit'] != NULL)

    Peace,
     
    Barti1987, Jan 18, 2008 IP