Hi There,
I've been all over the internet reading up on APC, and it seems like a nifty way to detect file Uploading.
I am, however, having a problem.
I know how to call files and everything using Ajax, and that is what I am planning to do, but for Testing sake, I'm doing something like this.
Ok, so I have 3 files.
form.php upload.php status.php
form.php contains:
<input type="hidden" name="APC_UPLOAD_PROGRESS" value="1234" />
<input type="file" id="fileIn" name="file" />
(I am aware that I will need to use a unique ID in APC_UPLOAD_PROGRESS. Again, this is just for testings sake.)
Ok, Now Upload.php has the regular PHP upload script:
$origin = $_FILES['file']['name'];
if(move_uploaded_file(...etc...etc)...
And Status.php uses APC:
$upload = apc_fetch('upload_1234');
if ($upload) {
if ($upload['done'])
$percent = 100;
else if ($upload['total'] == 0)
$percent = 0;
else
$percent = $upload['current'] / $upload['total'] * 100;
echo $percent;
}
Now What I am doing is uploading a file using a regular HTTP method, and using another window to monitor Status.php.
The problem is; Status.php returns nothing!
However, If i write print_r(apc_fetch('upload_1234'));
into upload.php, it returns the correct array, with all the details etc..
What am I doing wrong?
Thanks.