Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2008
    Location
    Manchester
    Posts
    766
    Tokens
    0

    Default [PHP] How do I...?

    Say I have a large script which will take a long time to finish running, how do I make it so that it can run without the user loading the page and can just show its progress everytime the user refreshed.

    An example of what I want is the remote uploading on rapidshare.

  2. #2
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Jxhn View Post
    Say I have a large script which will take a long time to finish running, how do I make it so that it can run without the user loading the page and can just show its progress everytime the user refreshed.

    An example of what I want is the remote uploading on rapidshare.
    Are you talking about a cron? :S

  3. #3
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    529
    Tokens
    0

    Default

    Quote Originally Posted by Jackboy View Post
    Are you talking about a cron? :S
    He means like say it's a script that runs for an hour, but every time the user refreshes the page it'll show the LATEST progress e.g. 50% done (like a program installer.)

    That's AFAIK what he wants.

  4. #4
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by RichardKnox View Post
    He means like say it's a script that runs for an hour, but every time the user refreshes the page it'll show the LATEST progress e.g. 50% done (like a program installer.)

    That's AFAIK what he wants.
    Ohhh i see. Sorry for my misunderstanding hehe

  5. #5
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Humm, I duno how you would do it as Rapid Share is on a remote server.

    But heres how you would do it.

    - Find out the size of the file.
    - Every second, see how big the uploaded file is.

    Then divide it by 100 or something

    So if you was uploading a file called illegalsoftwareftw.rar and that was been uploaded to www.domain.com/uploads/illegalsoftwareftw.rar, you find the file size of just illegalsoftwareftw.rar, then every second fine the size of www.domain.com/uploads/illegalsoftwareftw.rar.

    Hope that makes sence

  6. #6
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Vouches
    [x][x]

  7. #7
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Quote Originally Posted by Jack120 View Post
    Humm, I duno how you would do it as Rapid Share is on a remote server.

    But heres how you would do it.

    - Find out the size of the file.
    - Every second, see how big the uploaded file is.

    Then divide it by 100 or something

    So if you was uploading a file called illegalsoftwareftw.rar and that was been uploaded to www.domain.com/uploads/illegalsoftwareftw.rar, you find the file size of just illegalsoftwareftw.rar, then every second fine the size of www.domain.com/uploads/illegalsoftwareftw.rar.

    Hope that makes sence
    Uploading doesn't work that way though.

    When you're uploading it to the server, you're first having to put the ENTIRE file into an HTTP request.

    Then you're sending that HTTP request to the server, with the file data in it.. (file data, filename, and all the headers).

    Once that gets to the server, it's automatically re-rerouted and saved into a tmp directory (that's what that tmp_name is for)..

    It's not directly stored in an upload directory until your script tells it to do so, whether through your own custom process, or (is_uploaded_file()/move_uploaded_file() )

    So really checking the file size of something every few seconds.. isn't going to matter in a case like this, as by the time it's already in the tmp directory / your directory.. it's already been processed and fully uploaded and stored.

Posting Permissions

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