I'm trying to add an AJAX callback on a file-upload form-item. By doing so, I'm trying to upload a file automatically and immediately show a preview of this image.
The automatic file upload can be done with the AutoUpload-module, but this doesn't generate a preview of the image, hence the custom AJAX callback.
I tried to add an AJAX callback on my form with help of the form API, like this:
$form['field_frontpage_images']['#ajax'] = array(
'callback'=>'create_preview',
'wrapper'=> 'image_preview',
'method'=> 'replace',
'effect'=> 'fade',
);
Where the create_preview-callback provides an image preview. But I don't get things working... Is there a method/module I'm overlooking here?
How can I get a preview on uploading an image when creating content (preferable by not having to use the 'upload' button)?