huh...it somehow works with
<?php echo $html->image('link_flyer_path_temp' . "?" .
rand());?>

but only if there is already a picture in that specific path that gets
overwritten....its so freakin weird.....in case there is already a pic
and i upload a new one, it actually renders the new one...wtf?

maybe this whole think is related to mars or sth....any idea?

On 24 Aug., 08:32, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
> wow thats a lot of useful information :)
>
> i will give everything a try .... thank you sam.. in case i fail, i
> might come back here :)
>
> On 23 Aug., 19:15, Sam <s...@masterscommission360.com> wrote:
>
> > Add an alert statement into renderflyerpreview() to see if it is
> > executing when you upload a new picture. If it is executing, you may
> > be right about the caching issue. If so, add a random query string
> > onto the edge of the source of your image in the render_flyer element,
> > something like <?php echo $html->image('link_flyer_path_temp' . "?" .
> > rand());?>... this should defeat browser caching.
>
> > Also- I just noticed that you are calling refreshFlyer using setTimout
> > of 500ms... that may be your problem- you are only allowing .5 seconds
> > for the image to upload, so you may be calling the refreshFlyer
> > function before the image is actually uploaded. Look into using
> > callback functions with your javascript- they basically allow you to
> > call a function once something else has been completed.
>
> > Also- to speed the whole process up, why make two calls to the cake
> > app- one to upload the image and one to get the html of the image- why
> > not just have your processFlyer action render out the html you want
> > displayed? That should both speed up your app(less time making
> > requests to the server) and eliminate the need for setTimeout.
> > Additionaly, to make things even faster, just have the function return
> > the location of the new image and have jquery update the src of the
> > image already on the page.
>
> > On Aug 23, 8:01 am, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
> > > yes, it shows the picture...it works fine the first time....but if i
> > > repeat the process the new pic wont be rendered...
>
> > > i am using jquery.....thx for the tip
>
> > > On 23 Aug., 04:13, Sam <s...@masterscommission360.com> wrote:
>
> > > > 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