Closed joodya closed 11 years ago
There is no Uploader
class so I'm not sure where you are getting that information from.
The documentation is based loosely off Valums AJAX file uploader: http://valums-file-uploader.github.io/file-uploader/ Or the newer FineUploader: http://docs.fineuploader.com
ok i want to make it work with ajax and actAs-Behaviour how can i do that?
I try to do it but i don't know how ?? the file uploaded and it work but not with Ajax i want to upload it without reload page
my view echo $this->Form->create('Photo',array('type' => 'file')); echo $this->Form->input('path', array('type' => 'file','label' => false, 'div' => false, 'multiple' => 'multiple')); echo $this->Form->end(' Publier ' );
my function add in controller (photo)
public function add() {
if ($this->request->is('post')) {
$this->request->data['Photo']['nom'] = $this->request->query['name'];
if ($this->Photo->save($this->request->data)) {
// File uploaded and record saved
}
}
}
my model(Photo.php)
public $actsAs = array(
'Uploader.Attachment' => array(
'path' => array(
'tempDir' => TMP,
'uploadDir' => 'img/publication/photos',
'finalPath' => '/img/uploads/',
'prepend' => 'photo_',
'dbColumn' => 'path',
//'name' => '',
'transforms' => array(
'imageMedium' => array(
'method' => 'resize',
'append' => '-medium',
'width' => 600,
'height' => 600,
'aspect' => false
)
)
)
)
);
I haven't done this in years, so it's up to you. How would you approach this yourself?
Like any problem, you should get AJAX uploading working without using the Uploader, or at a minimum get the file posting to the URL and work from there.
http://docs.fineuploader.com/branch/master/integrating/server/
thank you for this plugin ,it work perfectly for static upload with $actAs = 'Uploader.Attachment'but
I want to use it with JS helper in CakePHP. In your documentation, there is only a small description explaining about uploading using AJAX, and I don't quite get it.
i try to use it like this in my add function in controller
$this->Uploader = new Uploader(array('ajaxField' => 'qqfile')); $data = $this->Uploader->upload($this->Uploader->ajaxField);
but it give me this error Erreur: Class 'Uploader' not found
Would you mind giving me an example of using your plug in with AJAX? or The simple Question: Is there anyway to make an ajax-Upload happen through the actAs-Behaviour?
That would be very much appreciated. Thanks in advance.