www.webdeveloper.com
Results 1 to 6 of 6

Thread: Upload Files To Folder (Max Size)

  1. #1
    Join Date
    Jul 2006
    Posts
    3

    resolved Upload Files To Folder (Max Size)

    I am looking for a simple php code that does the following. Uploads a file, up to 50MB, and stores it in a folder. I can find code to do this, but what I really need is a animated image to be played during the upload... and once its done, the image goes away and it says "Upload complete"... thanks so much ahead of time.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,337
    Some output buffering along with a bit of JavaScript can do something like that:
    PHP Code:
    <?php
    ob_start
    ();
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang='en'>
    <head>
    <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
    <title>Upload File</title>
    <script type="text/javascript">
    function hidediv(id) {
        //safe function to hide an element with a specified id
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById(id).style.display = 'none';
        }
        else {
            if (document.layers) { // Netscape 4
                document.id.display = 'none';
            }
            else { // IE 4
                document.all.id.style.display = 'none';
            }
        }
    }
    </script>
    </head>
    <body>
    <div id='working'>
    <img src="http://www.charles-reace.com/image/cornet.jpg" alt="cornet">
    </div>
    <?php
    ob_flush
    ();
    flush();  // image should now be displayed

    // simulate time to process upload
    sleep(5); // your actual upload processing code would go here 
    ?>
    <script type="text/javascript">
    hidediv("working");
    </script>

    <p>All done!</p>
    </body>
    </html>
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,337
    It occurred to me after I wrote the above that this probably isn't what you're looking for, as it would only display the "processing" image after the file was received. (The time to process the file on the server once it's received will likely be significantly less than the upload time. Perhaps this is something that can be done via JavaScript on the form page that sends the file?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Jul 2006
    Posts
    3

    Yea...

    Yea, I am looking for something that displays the image while its uploading, to let the user know that there stuff is being uploaded to my server. Nothing fancy, just a animated gif. I only really know my way around CSS, XHTML, and XML... so ya. I will try posting this in the JavaScript forum because according to you it should be done via JavaScript? Thanks for your help though!

  5. #5
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    For files bigger than about 2Mb it is far more efficient to use FTP processing than anything else for the transfer since most other methods limit you to about 2Mb max size and are extremely inefficident above that size anyway.
    Stephen

  6. #6
    Join Date
    Jul 2006
    Posts
    3
    @ Felgall
    how would you go about implementing that into a script?


    http://www.fhnfilms.com/index2.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles