Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder nomanic's Avatar
    Join Date
    Feb 2009
    Location
    United Kingdom
    Posts
    255
    Thanks
    9
    Thanked 33 Times in 33 Posts

    File Upload with Progress Bar php/javascript

    does anyone know a good file upload with progress bar, I've tried and tried to implement one with no luck at all, just cant seem to get it to work

    any advice would be most helpful, many thanks

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,169
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Would appreciate it if you wouldn't send private messages to many people until you've waited a reasonable time for an answer in the forums. No, 2 hours is not a "reasonable time". Depending on how active the forum is, maybe 12 hours to 2 days.

    Anyway, same answer I gave you privately:

    ****************

    I can't see why it would be that hard, depending on what backend technology you are using.

    You'd need to be using a backend such as ASP or JSP that allows "session state". You would make *TWO* AJAX requests on the server. First, you'd initiate the data request. Then you'd make a request for the progress percentage. Two different "pages" that share the same session. The one fetching the data would need to store its progress in a session variable. The one getting the progress value would simply read that session variable and return the number to its caller. That caller would update the display and then (perhaps after waiting 1 to 5 seconds, depending on the expected data fetch time?) ask again for the progress.

    If the two "pages" can't share session info, then they could share the info via a simple database table. The client could pass a guid, say, to both of them and the data grabber would store a record with that guid as the key value and the percentage progress as the data. Really the same thing as sharing the session, just done ad hoc instead of via the builtin mechanisms.
    *******************

    Never done this, but can't see that it would be that hard.

  • #3
    Regular Coder nomanic's Avatar
    Join Date
    Feb 2009
    Location
    United Kingdom
    Posts
    255
    Thanks
    9
    Thanked 33 Times in 33 Posts
    Thankyu so much for your help Old Pedant, but it simply doesn't mean anything to me
    I wouldn't know how to code such a thing
    when I follow a tutorial it works on their site but not locally on mine once I've followed their instructions, I'm just trying it without knowing what I'm doing at all with this
    anyone feel like leading me by the hand? or know a good tutorial?
    sorry to ask

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,169
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Ahh, see, that's an entirely different question!

    You said "I've tried and tried to implement one with no luck..." So I assumed you meant that YOU were doing the coding!

    What you seem to be looking for, really, is a precanned solution, no?

    And no, that I don't have. I do know that a company named Persits has done almost exactly what I described for the last 6 to 8 years, long before AJAX came into being. They do it using an <IFRAME>. They use a META REFRESH in the <IFRAME> to keep loading in a new progress image. But, as I said, it only works because both the page displayed in the <IFRAME> and the page that is doing the work (in their case, it's for a file upload control) are able to share "session" information. It happens to be written in ASP code, but I know the same concept would work fine with JSP. I don't use PHP, so I dunno if PHP supports "session variables" in the same way, but if it does then you could use the same technique.

    I really do think that an experienced PHP and JavaScript developer could throw this together in a couple of hours (again, assuming that PHP supports session varaibles the same way...add a few more hours if the session trick wouldn't work), but with no experience in PHP, that person isn't me. I could do it in ASP or JSP, though. Maybe not the prettiest version, but it would work, I think.


  •  

    Posting Permissions

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