Topic: Calling separate PHP library after FileUploaded
I'm fairly new to PHP so hopefully this turns out to be trivial. I have Plupload running on my server using the example implementation and everything works smoothly. However, after a file is finished uploading, I'd like to pass the $fileName variable to a separate PHP library which will upload them to a separate server. What I have right now is the example jQuery queue widget sending files to the example upload.php, with this tacked on to the end of it:
include 'phplibrary.php';
try {
// Plupload $targetDir is imgcache/
$f->images_upload("File=imgcache/".$fileName);
}
catch ( Exception $e ) {
echo "{$e->getMessage()} (Error Code: {$e->getCode()})";
}
But instead of passing the file to the library once all the chunks have been uploaded, this passes the file each time a new chunk has been completed. So I end up with multiple successive fragments on the second server whenever the file is bigger than the chunk size. Looking through the API, it seems like the FileUploaded event would be useful in correcting this, but I can't figure out how to implement it with uploader.bind or within upload.php
If anyone has an idea I'd appreciate it.