I see. That is a cool idea, but you are right, concurrency could definitely be a problem. That's what APC is supposed to solve because it tags the file with a unique ID. But I can't get that sucker to return the value to me! If I could get APC to work I would be done.

I also started looking at trying to grab the temp file, ". $_FILES['video_file']['tmp_name'], and then keep checking its size on the server, but I don't think I can get the temp name from php until it is uploaded. Do you know if that is possible?

One other thing, I looked at a canned media management web app ($875 US) that will do this uploading, and it doesn't require APC, so there definitely is some way to do this with basic PHP.

Thanks, Phred

On Sep 14, 2009, at 1:55 PM, Andrea Giammarchi wrote:

The concept of my last link is this:
the instant before you do the upload you ask PHP to scan the tmp folder, or the folder used to upload files (often the tmp) and you snap number of files, then the upload starts, and it will create a temp file with a PHP predefined prefix, you array_diff the snap with the current file list and you get the file that the user is uploading.

At that point if you are lucky the input="file" field will give you access to its fileSize, and you have everything to create a progress bar: the polled incremental tmp file size in the server, plus the total in the client, a bit of transitions/effects and that's it.

This method is not ideal, generally speaking, because it could easily suffer concurrency between multiple users.

I did not know Flash player had to put the entire file in memory, it sounds truly silly for scalability reasons, are you absolutely sure about this?

About APC you need to enable it and so far I had no problems with files up to 350 Mb , I wonder why 1Gb should be a problem.


Date: Mon, 14 Sep 2009 13:16:13 -0500
Subject: Re: [PHP] APC - Upload progress problem. apc

On Sep 14, 2009, at 9:15 AM, Tom Worster wrote:

with files that big, perhaps could write client js that polls a
script on
the server that simply returns the file size(s)? if you want a
use the number to resize a colored div.

Thanks Tom, for weighing in.

Having js poll a script on the server is kind of what APC was about,
and perl as well. Are you saying I could use PHP on the server side to
do this? It seems almost obvious, but no one mentions it any where on
the web, so a expected there was some fundamental limitation without

Do you have any idea what this script might look like? Is it possible
to get the temp file name before the upload is completed so that its
size can be monitored?

If it is, it is just too dang simple! ...but I'd take it for sure.

Thanks, Phred

PHP General Mailing List (
To unsubscribe, visit:

More than messages–check out the rest of the Windows Live™.

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to