title: TypeError: jQuery(...).ajaxForm is not a function magento
body: <p>I want to upload image and show through ajax in magento frontend.But I am getting this error <code>TypeError: jQuery(...).ajaxForm is not a function</code> which create problem to upload image in define folder and show in frontend.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script type="text/javascript" src="&lt;?php echo Mage::getBaseUrl();?&gt;/skin/frontend/rwd/default/js/jquery.form.js"&gt;&lt;/script&gt;
  
                          &lt;form id="imageform" method="post" enctype="multipart/form-data" action='&lt;?php echo $this-&gt;getUrl('productcustomize/index/uploadimage/'); ?&gt;'&gt;
  
                             &lt;div class="right"&gt;
  
                                      &lt;h3&gt;UPLOAD YOUR PICTURES&lt;/h3&gt;                                    
                                      &lt;h4&gt;Side Profile&lt;/h4&gt;
                                      &lt;span&gt;Sample Picture&lt;/span&gt;
                                     &lt;input type="file" name="photoimg" id="photoimg" /&gt;                                
  
                                  &lt;/div&gt;
                                  &lt;div id='preview'&gt;&lt;/div&gt;
  
                          &lt;/form&gt;
  &lt;script type="text/javascript" &gt;
   jQuery(document).ready(function() { 
  
              jQuery('#photoimg').on('change', function()         { 
                         jQuery("#preview").html('');
                  jQuery("#preview").html('&lt;img src="&lt;?php echo Mage::getBaseUrl();?&gt;/skin/frontend/base/default/lotusbreath/onestepcheckout/images/loader.gif" alt="Uploading...."/&gt;');
              jQuery("#imageform").ajaxForm({
                          data: jQuery(this).serialize(),
                          target: '#preview'
          }).submit();
  
              });
          }); 
  
  &lt;/script&gt;
  </code></pre>
  
  <p>IndexController.php</p>
  
  <pre><code> public function uploadimageAction()
       {
  
          $path = getcwd()."/media/sideprofile/";
  
          $valid_formats = array("jpg", "png", "gif", "bmp");
          if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST")
          {
              $name = $_FILES['photoimg']['name'];
              $size = $_FILES['photoimg']['size'];
  
              if(strlen($name))
                  {
                      list($txt, $ext) = explode(".", $name);
                      if(in_array($ext,$valid_formats))
                      {
                      if($size&lt;(1024*1024))
                          {
                              $actual_image_name = md5(date('Y-m-d H:i:s')).".".$ext;
                              $tmp = $_FILES['photoimg']['tmp_name'];
                              if(move_uploaded_file($tmp, $path.$actual_image_name))
                                  {
  
                                      $_SESSION['custom_image'][] = $actual_image_name;
                                      $custom_image_data = $_SESSION['custom_image'];
                                      foreach($custom_image_data as $key=&gt;$img){
                                          if($img !=""){
                                          $resizeimg = Mage::getBaseUrl().'/media/sideprofile/uploads/'.$img;
  
                                        }
                                      }
                                  }
                              else
                                  echo "failed";
                          }
                          else
                          echo "Image file size max 1 MB";                   
                          }
                          else
                          echo "Invalid file format..";   
                  }
  
              else
                  echo "Please select image..!";
  
              exit;
          }
       }
  </code></pre>