Results 1 to 6 of 6

Thread: Upload Script - Wont Upload Big Files

  1. #1

    Thread Starter
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Upload Script - Wont Upload Big Files

    I recently edited my image upload script because it was poorly written the first time, and now it wont upload files larger then a thumb nail. I am not getting any errors or anything. I changed my error_reporting to E_ALL | E_STRICT and only get undefined variable warning.


    i have 200+ lines of code in this script, so here is just the main upload part:

    PHP Code:
    switch($newalbumstat) {
        case 
    "true":
            
    #IS A NEW ALBUM, GET ALBUM ID, INSERT INTO DB, THEN UPLOAD
            
    $sql "SELECT `album_id` FROM `picture_albums` WHERE `name`='$newalbum' AND member_id='$memid' LIMIT 1";
            
    $query mysql_query($sql);
            
    $a mysql_fetch_array($query);
            
    $albumid $a['album_id'];
            
            
    #ADD IMAGE TO DATABASE
            
    $fullurl "http://pics.rapidfriends.com/$memid/$newpicname";
            
    $uploadurl "pics/$memid/$newpicname";
            
    $caption $_POST['caption'];
            
    $sql "INSERT INTO `pictures` SET member_id='$memid', caption='$caption', url='$fullurl', album='$albumid'";
            
    $query mysql_query($sql);
            
            
    $result move_uploaded_file($_FILES["image"]["tmp_name"], $uploadurl);
            
    func_makethumb_avatar_upload($uploadurl,400,$ext);
            
    $res=chmod($uploadurl,0755);
            break;
        
        case 
    "false":
            
    #NOT A NEW AlBUM
            //$albumid = $_POST['album'];
            
    $fullurl "http://pics.rapidfriends.com/$memid/$newpicname";
            
    $uploadurl "pics/$memid/$newpicname";
            
    $caption $_POST['caption'];
            
    $sql "INSERT INTO `pictures` SET member_id='$memid', caption='$caption', url='$fullurl', album='$albumid', location='$uploadurl'";
            
    $query mysql_query($sql);
            
            
    $result move_uploaded_file($_FILES["image"]["tmp_name"], $uploadurl);
            
    func_makethumb_avatar_upload($uploadurl,400,$ext);
            
    $res=chmod($uploadurl,0755);
            break;

    My usual boring signature: Something

  2. #2
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403

    Re: Upload Script - Wont Upload Big Files

    It's possible that if uploading a large file takes too long, your script or the web server is hitting a timeout. The default max execution time on php is 30 seconds, so if it's failing quicker than that you can ignore the max_execution_time directive.

    You'll also need to check what your timeout is set to on your webserver; apache and IIS both default to 300 seconds according to the PHP page.

    Hope this helps.
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Upload Script - Wont Upload Big Files

    Maximum execution time exceeded will produce a fatal error. Have you checked the error code for the uploaded file $_FILES['filename']['error'].

    You also need to check the upload_max_filesize directive in php.ini. If your upload size is bigger than this, it will fail.

    And WHEN are you going to learn to escape variables that go into sql?
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Upload Script - Wont Upload Big Files

    escape meaning using / / ?

    field=/"test"/?
    My usual boring signature: Something

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Upload Script - Wont Upload Big Files

    No, a backslash. mysql_escape_string()
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Upload Script - Wont Upload Big Files

    I told you it would be easier to use MySQLi or PDO.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width