A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: File upload issue (NOT max upload limit)

  1. #1
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320

    File upload issue (NOT max upload limit)

    hi guys,

    I am having a bit of bother with my upload script.

    The script runs fine for small files, 5,6,7 meg but as soon as i use a file 30 meg it stops working.

    Max upload limit is 50meg
    max_execution_time is 2400 // 40 minutes
    max_input_time is 2400

    I adjusted these settings because my upload speed sucks and a 30 meg file takes the best part of 20 minutes to upload.

    I have already spent the best part of today trying to figure this out but i am now at a loss and out of time.
    Below is the script and does work for smaller files.

    i don't know what else i can check

    PHP Code:
    $upID         $_GET['upID'];
    $upType     $_GET['upType'];
    $upDate        date("Y-m-d h:i:s"); 
    $movieName    strtolower($_FILES['Filedata']['name']);

    $newName    substr($movieName0, -4);
    $newMovie    "lesson_movie.flv";
    $myLog "../logs/".$upID."_logged.log"
    $myHandle fopen($myLog,'a');          
    $startTime date("Y-m-d h:i:s"); 
    //-------------------------------------------------------------
    if($upType == "new"){
        
    $logTxt "************************* BEGIN $startTime ADD NEW*************************\n\n";
        
    fwrite($myHandle,$logTxt);
        
    $xDestination "../media/mentorMedia/temp_".$upID;
        if(!
    is_dir($xDestination)){
            
    mkdir ($xDestination);
        }
        if(
    move_uploaded_file($_FILES['Filedata']['tmp_name'], $xDestination."/".$movieName)){ 
        
    //-------------------do conversion-------------------------------------------------//
            
    $toexec "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\\temp_".$upID."\\".$movieName." -r 15 -ar 22050 D:\wwwroot\media\mentorMedia\\temp_".$upID."\\".$newMovie;
            
    $doWhat "Convert ".$movieName." to ".$newMovie;
            
    $logTxt "Working on job $doWhat\n";
            
    fwrite($myHandle,$logTxt);
            
    $logTxt "Command to run: $toexec\n\n";
            
    fwrite($myHandle,$logTxt);
            
    exec("$toexec",$output,$result1);
            if(
    $result1 == 0){
                
    $logTxt "\n\nSuccessfully ran job $toexec\n\n\r";
                
    fwrite($myHandle,$logTxt);
                
    $toexec2 "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\\temp_".$upID."\\".$movieName." -ss 2 -vframes 1 -f mjpeg D:\wwwroot\media\mentorMedia\\temp_".$upID."\\thumb_lesson.jpg";
                
    exec("$toexec2",$output2,$result2);
                if(
    $result2 == 0){            
                    
    $logTxt "\n\nSuccessfully ran $toexec2\n\n\r";
                    
    fwrite($myHandle,$logTxt);
                    
    resizeImage($xDestination."/thumb_lesson.jpg"320240100$xDestination."/thumb_lesson.jpg"false);    
                    
    unlink($xDestination."/".$movieName);
                }else{
                     
    $logTxt " Second execute failed: ".$toexec2."\n\r";
                    
    fwrite($myHandle,$logTxt);
                 }
            } else {
                
    $logTxt " First execute failed: ".$result1."\n\r";
                
    fwrite($myHandle,$logTxt);
            }
            
    $endTime date("Y-m-d h:i:s"); 
            
    $logTxt "************************* END $endTime ADD NEW***************************\n\n\r";
            
    fwrite($myHandle,$logTxt);
            
    fclose($myHandle);
        }
    }else if(
    $upType == "replace"){
        
    $classID         $_GET['classID'];
        
    $lessonID         $_GET['lessonID'];
        
    $xDestination     "../media/mentorMedia/classes/".$classID."/lesson_".$lessonID;
        
    //
        
    $del_1        unlink($xDestination."/lesson_movie.flv");
        
    $del_2        unlink($xDestination."/thumb_lesson.jpg");
        if(
    move_uploaded_file($_FILES['Filedata']['tmp_name'], $xDestination."/".$movieName)){ 
        
    $logTxt "************************* BEGIN $startTime REPLACE *************************\n\n";
        
    fwrite($myHandle,$logTxt);
        
    //-------------------do conversion-------------------------------------------------//
    $toexec "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\\".$movieName." -r 15 -ar 22050 D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\\".$newMovie;
            
    $doWhat "Convert ".$movieName." to ".$newMovie;
            
    $logTxt "Working on job $doWhat\n";
            
    fwrite($myHandle,$logTxt);
            
    $logTxt "Command to run: $toexec\n\n";
            
    fwrite($myHandle,$logTxt);
            
    exec("$toexec",$output,$result1);
            if(
    $result1 == 0){
                
    $logTxt "\n\nSuccessfully ran job $toexec\n\n\r";
                
    fwrite($myHandle,$logTxt);
                
    $toexec2 "D:\ffmpeg\bin\ffmpeg.exe -i D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\\".$movieName." -ss 2 -vframes 1 -f mjpeg D:\wwwroot\media\mentorMedia\classes\\".$classID."\\lesson_".$lessonID."\\thumb_lesson.jpg";
                
    exec("$toexec2",$output2,$result2);
                if(
    $result2 == 0){            
                    
    $logTxt "\n\nSuccessfully ran $toexec2\n\n\r";
                    
    fwrite($myHandle,$logTxt);
                    
    resizeImage($xDestination."/thumb_lesson.jpg"100100100$xDestination."/thumb_lesson.jpg"false);    
                    
    unlink($xDestination."/".$movieName);
                }else{
                     
    $logTxt " Second execute failed: ".$toexec2."\n\r";
                    
    fwrite($myHandle,$logTxt);
                 }
            } else {
                
    //Command failed
                //Add result to logfile
                
    $logTxt " First execute failed: ".$result1."\n\r";
                
    fwrite($myHandle,$logTxt);
            }
            
    $endTime date("Y-m-d h:i:s"); 
            
    $logTxt "************************* END $endTime REPLACE ***************************\n\n\r";
            
    fwrite($myHandle,$logTxt);
            
    fclose($myHandle);
        }

    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  2. #2
    G-Mace cougrhky20's Avatar
    Join Date
    Aug 2001
    Location
    Northern Virginia
    Posts
    156
    Check you php.ini file. You might have to change the max_execution_time varaible and maybe some others.

  3. #3
    G-Mace cougrhky20's Avatar
    Join Date
    Aug 2001
    Location
    Northern Virginia
    Posts
    156
    Also check the file upload section in php.ini, particularly if you have upload_max_filesize set.

  4. #4
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    I adjusted every piece that i was aware of. Thankfully another peep point out "post_max_upload" was set to 8meg.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  5. #5
    G-Mace cougrhky20's Avatar
    Join Date
    Aug 2001
    Location
    Northern Virginia
    Posts
    156
    So, I'm taking it that everything is working ok now? good luck with the proj.

  6. #6
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    good to know.. I am about to work on an UPLOAD option as well was going to use FileReference.. does it have a limit?

    I see you are using PHP? can this be used? Masked? to seamlessly let a user upload per chance? if FileReference does have size limits?

    thanks

    trying to get my ducks in a row before I start this project (and waste time)

  7. #7
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    1. Flash file upload has no limits
    2. You need php to handle the upload request
    3. You can set the size limit of files in flash before the upload starts

    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  8. #8
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    hmm.... I wonder what is correct? The LiveDocs say:

    "Starts the upload of a file selected by a user to a remote server. Flash Player can upload files of up to 100 MB. You must call FileReference.browse() or FileReferenceList.browse() before calling this method."


    So there is NO 100MB limit?..or there is?

  9. #9
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    If thats what the flash doc's say then that would be correct. I have never tried to upload a file of that size via flash. The largest file i have uploaded is 30mb.

    Good to know.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  10. #10

  11. #11
    Arabic Flasher
    Join Date
    Jul 2001
    Location
    Saudi Arabia
    Posts
    190
    hi,

    i don't think the flash was limit the upload size

    i was test that with 400mb

    u need to add some code for the server to let the script work for the max uploaded files limit

    all u need is just an .htacess file put it in the root of your php script


    Code:
    php_value post_max_size 500M
    php_value upload_max_filesize 500M
    also u need to limit the time excution for the php script by add the code
    Code:
    set_time_limit(0);
    let me know your result and hope that help
    Last edited by moh_design; 04-13-2007 at 08:34 PM.


    http://www.flashyat.com/

  12. #12
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    I/we are aware of the settings that need to be adjusted in the php.ini file but thanks for your input anyway.
    400mb you have uploaded from flash?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  13. #13
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    OK... I know you have to use PHP as the backend to actually 'save' the file to the destination..

    But the livedocs say 100MB.. If this "IS" in fact controlled by the default PHP.ini file.. I dont see how they can say there is a limit?

    My next question is:

    how many people can actually change their php.ini files?? People on a shared web hosting plan do not have access do they?

    (Thanks)

  14. #14
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    php default installation sets upload at 2mb. I think you can change this during the execution of yuor upload script.


    Peeps on shared hosting cant change the php.ini file. In most case's you would need to contact hosting admin.
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  15. #15
    Arabic Flasher
    Join Date
    Jul 2001
    Location
    Saudi Arabia
    Posts
    190
    guys please read my post again

    i don't talk about php.ini or to do any change for it

    you have another way to set the max uploaded size by using the file

    Code:
    .htaccess
    so [THIS] Settings will be controled by .htaccess file not by php.ini

    and for webdreamer yes i was uploaded 400mb file successful by flash

    try it guys
    Last edited by moh_design; 04-14-2007 at 08:47 PM.


    http://www.flashyat.com/

  16. #16
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    what are the entries you need to add/edit into the .htaccess file?

    I have never made edits to it before..

    (I also need to edit it to tell the server to parse all HTML pages as well so I can use regular #includes )

    so this:
    Code:
    php_value post_max_size 500M
    php_value upload_max_filesize 500M
    set_time_limit(0);
    is what goes in the .htaccess file?
    thanks

  17. #17
    Arabic Flasher
    Join Date
    Jul 2001
    Location
    Saudi Arabia
    Posts
    190
    hi whispers

    the .htaccess file makes rules for the root you add on

    ex:
    if u add the file into public_html the rules will be add to all the folder and files into your server

    if u add the files into dir: public_html/upload/flash/

    the rules will be add into just this root and the folder, files into.

    the code
    Code:
    set_time_limit(0);
    it's not for the .htaccess file

    it's for your uploader script

    PHP Code:
    <?php
    set_time_limit
    (0);
    //your code here

    ?>
    this code'll makes script run forever until the uploaded file finish


    http://www.flashyat.com/

  18. #18

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

HTML5 Development Center