If you actually go the renderflyerpreview action does it show the
picture? Are you sure that your refreshflyer() function is actually
running when you reload an image?

Also, on a side not, are you using jQuery? If so, there is a more
elegant way to do some of this coding... For example, instead of using
onClick in:
"<button onClick="functionCaller(this.form)" type="button">Hochladen</
button>"

You could add an id to the button and use a jQuery selector to attach
an event handler- that way all your javascript is in one place.
e.g.(if the id was uploadSubmitButton)

$(document).ready(function(){

$('#uploadSubmitButton').click(function(){
//functionCaller code
});

});

On Aug 22, 12:15 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com>
wrote:
> hi,
>
> i am having a weird problem. on a site, a user can upload a picture.
> when its uploaded the picture gets loaded in a div area as a preview.
> now that works fine. but if i do this whole thing again, maybe cause i
> want a different picture, the new picture is not loaded, although the
> uploading process worked. i checked on my HDD.
>
> this is what i do:
>
> i have a form for the file uploading in my view:
> <?php
> echo $form->create('Link',
> array('name'=>'uploadProfileImageForm','id'=>'uploadProfileImageForm','type 
> '=>'file'));
> echo $form->file('Link');
> ?>
>                                 <div class="submit">
> <button onClick="functionCaller(this.form)" type="button">Hochladen</
> button></div>
>  <?php
> echo $form->end();
> ?>
>
> now a JS function is called to acutally upload the pic, to show the
> ajax loading icon, and to call the function, that acutally renders the
> uploaded image in a specific div for a preview.
>
> function functionCaller(form)
> {
>         ajaxUpload(form,'processFlyer','flyer_css','<img src=\'../img/icons/
> loader.gif\' width=\'16\' height=\'16\' border=\'0\' />','Fehler beim
> Upload');
>         setTimeout("refreshflyer()", 500);
>         //refreshdiv();
>
> }
>
> calling a controller function to render the pic from this JS function
>
> function refreshflyer(){
>
>         $('#flyer_preview').load('renderflyerpreview');
>
> }
>
> and that is the functin in my controller that gets the path to the
> image and renders it in a div in my view
>
>     function renderflyerpreview()
>     {
>         $this->set('link_flyer_path_temp', 
> ($this->Session->read('Link.flyer_path_temp')));
>
>         $this->render('render_flyer','ajax');
>     }
>
> as i said it works fine the first time you do upload an image...the
> second time...nope...the image gets uploaded, but not rendered!!??
> is this some sort of caching problem?
>
> BIG THX :)

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to