+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: How to get number of uploaded bytes in php

  1. #1
    oracle is offline x10 Lieutenant oracle is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    430

    How to get number of uploaded bytes in php

    Hello All,

    I know there exists a few upload progress showing scripts, but I wanted to know for knowledge sake how do I get to know how many bytes have been uploaded till now.

    move_uploaded_file($FileTemp,$FileUploadLocation)

    after giving this command how do I know how many bytes have been uploaded till now ?

  2. #2
    bugfinder's Avatar
    bugfinder is offline Retired bugfinder is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    2,260

    Re: How to get number of uploaded bytes in php

    Take a look at http://uk3.php.net/manual/en/reserve...bles.files.php

    It shows whats available about each file.
    :rant2:
    Please do not send me personal messages unless I have requested you to do so.
    Thank you.

    You can join us on irc for support and chat
    2 - connnect to irc either by the web interface or direct irc://irc.x10hosting.com:6667

  3. #3
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: How to get number of uploaded bytes in php

    He's not asking about information about the posted file, he wants some sort of thread-like system that tracks how many bytes have already been uploaded...

    But why would you want it? I don't think it's possible to do something like that in php, but perhaps we can find a way around the problem?
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

  4. #4
    bugfinder's Avatar
    bugfinder is offline Retired bugfinder is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    2,260

    Re: How to get number of uploaded bytes in php

    sure it is, if you look at the thing I posted you sum up the total bytes....
    :rant2:
    Please do not send me personal messages unless I have requested you to do so.
    Thank you.

    You can join us on irc for support and chat
    2 - connnect to irc either by the web interface or direct irc://irc.x10hosting.com:6667

  5. #5
    oracle is offline x10 Lieutenant oracle is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    430

    Re: How to get number of uploaded bytes in php

    I think you got it wrong.... I want to show a upload progress meter...

    I know there are many out there in the market but I want to build my own custom one. As I think it isnt a big issue in making one, so I dont consider it as reinventing the wheel

    Your given link doesnt show anything which can show something like 20% file is upload etc etc

    I want to show user % upload sort of thingy.

    Imoracle

  6. #6
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: How to get number of uploaded bytes in php

    You are going to have to use AJAX. http://tomas.epineer.se/archives/3
    I suggest you use a premade one thought.
    http://encodable.com/filechucker/
    http://www.sibsoft.net/xupload.html

  7. #7
    oracle is offline x10 Lieutenant oracle is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    430

    Re: How to get number of uploaded bytes in php

    Yeah surely it will be ajax, but then again you have posted an already made script for the same. I just want to know the method in PHP through which I can get the % upload and then I know how to use that.

    The site you gave is giving me 501 error , can you attach the codes if you have them?
    Last edited by oracle; 05-25-2008 at 09:04 AM.

  8. #8
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: How to get number of uploaded bytes in php

    Well... Now its giving me the same error...
    Anyway, you could look at the pre-made scripts' code and see how its done.

  9. #9
    mattura's Avatar
    mattura is offline x10 Elder mattura is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    563

    Re: How to get number of uploaded bytes in php

    It's not that simple...in fact it's not simple at all!
    You need to create an invisible iframe, and send the upload to that. Within the iframe, PHP code polls itself with the current filesize(), taken from the *.tmp file in the temp upload directory.
    You then use javascript to get what's in the iframe, and turn it into something useful (like x%, or a variable width bar) to display.

    Something similar is done here:
    http://indiza.com/alsanan/index.php?...E9rprete%20PHP
    Something slightly different is done (with ajax and a php patch) here:
    http://bluga.net/projects/uploadProgressMeter/

    Basically it's a beast of a problem, and these solutions are still not reliable (eg if two people upload something simultaneously)
    ----
    Life is a game. The conception is terrible but the graphics are amazing!
    matt.elementfx.com

  10. #10
    oracle is offline x10 Lieutenant oracle is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    430

    Re: How to get number of uploaded bytes in php

    Yeah I know the process of how exactly it is done, just that I am unable to figure out how to get the size of remaining upload file....

    This is what I am unable to figure out. If someone can help me with this, I will be able to figure out the rest easily.

    Lemme look at the first link by you, though its not in english.

    2nd one needs a patched version and I dont think we can do that here with shared hosting.

+ Reply to Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. Ever Been Suspended For Using PHP?
    By dragoneye_xp in forum Off Topic
    Replies: 26
    Last Post: 08-16-2009, 07:17 PM
  2. Pregunta sobre las Configuraciones PHP
    By Trevelin in forum Soporte
    Replies: 11
    Last Post: 04-28-2008, 01:50 PM
  3. [PHP] Placing the Ads in PHP Pages
    By Chris in forum Tutorials
    Replies: 22
    Last Post: 06-04-2005, 11:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers