Closed Thread
Results 1 to 3 of 3

Thread: PHP & AJAX upload & progress

  1. #1
    webcodez's Avatar
    webcodez is offline Programmer
    Join Date
    Feb 2010
    Posts
    148
    Rep Power
    0

    PHP & AJAX upload & progress

    Hi there,

    Currently working on a script to show the progress of an upload using PHP and AJAX. How would this be possible? Because my script doesn't seem to work, tried something like this:

    Code:
    <form method="POST" id="uploadForm" action="<?=$_SERVER['PHP_SELF'];?>" enctype="multipart/form-data" onSubmit="uploadProg()">
    <input type="file" name="uploadfile">
    <input type="button" value="Upload File!" name="upload" onClick="document.forms['uploadForm'].submit();">
    </form>
    
    <div id="uploadProg">
    
    </div>
    But upon submitting the form, the page refreshed and the uploadProg() ajax function ( which calls the PHP script to upload the file ) was not executed..

    Could someone please help me?

    Thanks in advanced!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    SoN9ne's Avatar
    SoN9ne is offline Programmer
    Join Date
    Mar 2010
    Location
    Juno Beach, Florida, United States
    Posts
    125
    Rep Power
    0

    Re: PHP & AJAX upload & progress

    If you use this:
    HTML Code:
    onSubmit="return uploadProg();"
    You can prevent the page from submitting by returning false.

    Since the page submits and the function never gets called, this could indicate an error in the js. Use firebug to isolate the error.
    Are you using firebug? Check to see if you get any console errors.
    Set a break point in uploadProg() and step through each line until you notice the issue.

  4. #3
    webcodez's Avatar
    webcodez is offline Programmer
    Join Date
    Feb 2010
    Posts
    148
    Rep Power
    0

    Re: PHP & AJAX upload & progress

    Thanks a lot

    Will have a look into Firebug too, would make it lot easier with all small javascript bugs in my scripts ;D

    Though, I think I'll be using SWFUpload which I found posted on another website which seems to be doing this job (progress bar of uploading) great!

    And as I'm more of a PHP/MySql coder than javascript, such scripts can come handy to me

    Cheers.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. PHP upload progress bar
    By welton122 in forum PHP Development
    Replies: 7
    Last Post: 11-02-2010, 04:22 AM
  2. Help with progress bar?
    By eliasmaq in forum Visual Basic Programming
    Replies: 2
    Last Post: 07-10-2010, 04:16 AM
  3. C# progress bar help
    By Siten0308 in forum C# Programming
    Replies: 8
    Last Post: 03-26-2010, 09:24 AM
  4. Progress bar help!! Right away!!
    By Leg3nd in forum C# Programming
    Replies: 1
    Last Post: 03-15-2009, 12:07 PM
  5. Progress bar help
    By mholt in forum C# Programming
    Replies: 2
    Last Post: 08-21-2008, 11:13 AM

Tags for this Thread

Bookmarks

Posting Permissions

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