I am Soooo disappointed! no file upload via xmlhttprequest!

Discussion in 'PHP' started by Sleeping Troll, Aug 23, 2008.

  1. #1
    OK, So I use a form and target an iframe, now how do I detect when file is done uploding and update page with uploaded image?
     
    Sleeping Troll, Aug 23, 2008 IP
  2. ForumJoiner

    ForumJoiner Active Member

    Messages:
    762
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    83
    #2
    This is a sample from the file wp-includes\js\swfupload\handlers.js, from WordPress 2.6.1
    http://wordpress.org/download/

    It's used when you upload a file, to display a progress bar.

    function uploadProgress(fileObj, bytesDone, bytesTotal)
    {
    	// Lengthen the progress bar
    	jQuery('#media-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal);
    
    	if ( bytesDone == bytesTotal )
    		jQuery('#media-item-' + fileObj.id + ' .bar').html('<strong class="crunching">' + swfuploadL10n.crunching + '</strong>');
    }
    Code (markup):
     
    ForumJoiner, Aug 23, 2008 IP