filesize() of an uploading file...

Discussion in 'PHP' started by tolgafiratoglu, Mar 26, 2008.

  1. #1
    I've created an upload-status bar with AJAX and setInterval. Everything is OK, but I have 1 problem.

    In the AJAX function I divide the current size of filesize("new_path") by $_FILES["video"]["size"] - which is it's real size.

    My aim is to print 100 times of it as the percentage. But sadly, PHP calculates
    the new path's size as the all size of the file.

    So it prints 100% from the begining to end. I guess the reason is: When it starts uploading, it books that amount of memory from the begining, so PHP calculates as if it's already uploaded.

    Do you know any solution? I want to put an upload status bar.
     
    tolgafiratoglu, Mar 26, 2008 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Are you sure?

    Try to upload the file and check the size while it is uploading using CP or SSH. Also insure that you are reading the file from the tmp_name.

    Peace,
     
    Barti1987, Mar 26, 2008 IP