Dear Bakers,
I'm creating a personal blog with registered users. I want the users
to be able to modify their profile anywhere in the site using Ajax...
In the blog, there is a column showing the User's Profile on a <DIV
id="profile">
By the moment I could succesfully do that they change their display
information and password with Ajax... but the problem is to change the
user's picture... I had been reading about it in this forum, and I
could understand that AJAX can't do the Upload itself, and an IFRAME
is needed... just my doubt is... if I modify <DIV id="profile"> inside
the blog page to display the view with AJAX that has to upload the
photo... and I place an IFRAME there... how to do it for the AJAX view
to know that the photo in the IFRAME was uploaded and then modify the
blog page's <DIV id="profile"> to show the updated user profile??...
Can somebody place the code??... This is the code I use to Update the
user's profile... now I want to do the code to Upload the user's
picture with AJAX+Iframe. Thank you

--------------------------------------------------------------------------------------------------
That's the blog's view part where the Profile Information is displayed
--------------------------------------------------------------------------------------------------
<?php if($login): ?>
      <div id='ajaxicon'><?php echo $html->image('ajax.gif',
array('border'=>"0",'align'=>"absmiddle")).' '.$lgloading; ?></
div><script>Element.hide("ajaxicon");</script>
      <div id="profile">
        <h3>User Profile</h3>
        <table border="0">
          <tr>
            <td width="100" valign="top"><div id="foto"><?php echo
$html->image('colegas/'.$colega['Colega']['icono'],
array('border'=>'0','align'=>'absmiddle')); ?></div></td>
            </td>
            <td valign="top">
              <?php echo $colega['Colega']['nombre']; ?><br>
              <?php echo $ajax->link('Edit Profile','../colegas/
perfil',array('update'=>'profile','loading'=>'Element.show("ajaxicon");','complete'=>'Element.hide("ajaxicon");stripe();'));
 ?
>
              <?php echo $ajax->link('Change photo','../colegas/
foto',array('update'=>'profile','loading'=>'Element.show("ajaxicon");','complete'=>'Element.hide("ajaxicon");stripe();'));
 ?
>
              <br>
              <?php echo 'Comments in Diary: '.$diarycmt; ?><br>
              <?php echo 'Comments in Gallery '.$albumcmt; ?><br>
            </td>
          </tr>
        </table>
      </div>
    <br>
 <?php endif; ?>

--------------------------------------------------------------------------------------------------
That's the part of the controller that edit the profile * NO PHOTO
--------------------------------------------------------------------------------------------------
function perfil()
    {
      $this->set('idioma',$this->Session->read('idioma'));
      $this->userprofile();
      if($this->data)
      {
        $this->data['Colega']['id'] = $this->Session->read('colega');
        $this->Colega->save($this->data);
        $this->redirect('colegas/refrescar); // This is to refresh the
<DIV>
      }
      else
      {
        $result = $this->Colega->findById($this->Session-
>read('colega'));
        $this->set('colega',$result);
      }
    }

--------------------------------------------------------------------------------------------------
That's the view with AJAX to edit the Profile * NO PHOTO
--------------------------------------------------------------------------------------------------
<?php echo $javascript->link('prototype'); ?>

        <h3><?php echo $lguserprofile; ?></h3>
        <table border="0">
          <tr>
            <td width="100" valign="top"><div id="foto"><?php echo
$html->image('colegas/'.$colega['Colega']['icono'],
array('border'=>'0','align'=>'absmiddle')); ?></div></td>
            </td>
            <td valign="top">
              <form action="<?php echo $html->url(''); ?>"
method="post">
                <table>
                  <tr><td>Name: </td><td><?php echo $html-
>input('Colega/nombre', array('value'=>$colega['Colega']['nombre'])) ?
></td></tr>
                  <tr><td>Password: </td><td><?php echo $html-
>input('Colega/password', array('value'=>$colega['Colega']
['password'])) ?></td></tr>
                  <tr><td>Email: </td><td><?php echo $html-
>input('Colega/email', array('value'=>$colega['Colega']['email'])) ?></
td></tr>
                  <tr><td colspan="2" align="center">
                          <?php echo $ajax-
>submit('Update',array('url'=>'','update'=>'profile','loading'=>'Element.show("ajaxicon");','complete'=>'Element.hide("ajaxicon");stripe();'));
> ?
>
                          <?php echo $ajax-
>submit('Cancel',array('url'=>'../colegas/
refrescar,'update'=>'profile','loading'=>'Element.show("ajaxicon");','complete'=>'Element.hide("ajaxicon");stripe();'));
 ?
></td></tr>
                </table>
              </form>
            </td>
          </tr>
        </table>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to