Hi stab,
I don't really know about ajax-upload. As I'm using plupload in one of
my projects and guess it's similar. You're right the media plugin's
transfer behavior doesn't natively handle streams, yet. Here's an
excerpt of the code I'm using to workaround that:
if ($this->RequestHandler->requestedWith('application/octet-stream'))
{
if (!$in = fopen('php://input', 'rb')) {
$this->cakeError('error500', array('api' => true));
}
$tmpFile = tempnam('/tmp', 'app_');
$tmp = fopen($tmpFile, 'wb');
while ($buf = fread($in, 4096)) {
fwrite($tmp, $buf);
}
fclose($in);
fclose($tmp);
$this->data['MediaFile']['file'] = $tmpFile;
} else {
$this->data['MediaFile'] = $this->params['form'];
}
Hope this helps,
- David
On 26 Okt., 10:02, stab <[email protected]> wrote:
> I'm trying to use this:http://valums.com/ajax-upload/with the media
> plugin herehttp://github.com/davidpersson/media
>
> I've got it setup ok, and it is attached to a Document model.
>
> I can also get the qquploader uploading fine using it's own examples
> and class libraries. I need to find a way to take the input from the
> ajax upload and then save it down in the normal manner using the
> plugin.
>
> It does use the php://input method which I think the media plugin
> doesn't use?
>
> Any help appreciated! Thanks
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en