title: File Upload in Magento frontend
body: <p>i want set profile image for customer and i upload image from my account tab and set tab separate for our custom module profile. when sent the image from .phtml then the array of $_FILES is empty so my question is that how set profile image for customer in magento my code is in my saveimageAction. so one they doing work on that?</p>
  
  <pre><code>print_r($_FILES);exit();
        if(isset($_FILES['profileimage']['name']) &amp;&amp; ($_FILES['profileimage']['tmp_name'] != NULL))
    {
        $uploader = new Varien_File_Uploader('file');
        $uploader-&gt;setAllowedExtensions(array('jpg','jpeg','gif','png')); 
        $uploader-&gt;setAllowRenameFiles(true);
        $uploader-&gt;setFilesDispersion(true);        
        $path = Mage::getBaseDir('media') . DS ;
        //$path= Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);     
  
        $path = $path ."supportportal/avatar";
        $uploader-&gt;save($path, $_FILES['profileimage']['name']);
  
        $simage = Mage::getModel('supportportal/profile');
        $simage-&gt;setData('user_id',$getuserid);
        $simage-&gt;setData('image', $userimage);
        $simage-&gt;setData('created_date',date('d-m-Y H:i:s'));
        $simage-&gt;setData('last_updated_date',date('d-m-Y H:i:s'));
        $simage-&gt;setData('status',1);
        $simage-&gt;save();
      Mage::getSingleton('core/session')-&gt;addSuccess( $this-&gt;__('Image is Successfully Save!') );
      Mage::app()-&gt;getResponse()-&gt;setRedirect(Mage::getUrl('supportportal/index/profile/')); 
  
      }else{
  
          Mage::getSingleton('core/session')-&gt;addError( $this-&gt;__('Image Saving Error!') );
      Mage::app()-&gt;getResponse()-&gt;setRedirect(Mage::getUrl('supportportal/index/profile/')); 
  
      }
  </code></pre>