how to add customer photo registration profile page in magento


how to add customer photo in magento registration – profile page

I have to add 3 image upload box as per my client demand. First one was his photo , second one was his credit card front side scan copy and third one was credit card back side scan copy. He did it for his customer verification.
Now i will explain you how i fix it.
At first change the registration and edit form type to enctype=”multipart/form-data”
Add the following code in register.phtml to add photo field in database
$setup = new Mage_Eav_Model_Entity_Setup(‘core_setup’);
$attr2 = array (
‘position’ => 1,
‘is_required’=>0 /* 0 if you want it to be a required field, 1 if not. Also, if required, add this class to the occupation input box on register.phtml class=”required-entry input-text” */
$setup->addAttribute(’1′, ‘photo’, $attr2);



Also add the new file type field into the above two forms. Add the code
Then add the new filed say name “photo” into the following file.
app/code/core/Mage/Customer/Model/Entity/Setup.php file.

‘photo’ => array(
‘label’         => ‘Photo1′,
‘required’      => false,
‘sort_order’    => 61,

Now update the following file with the photo field


Now modify the following file and wrote your code for uploading image :

In public function createPostAction() at the following lines.. at 274 line where checking form post

//Added by zahid for file upload
$logoName = ”;
if (isset($_FILES['photo']['name']) && $_FILES['photo']['name'] != ”) {
try {
$uploader = new Varien_File_Uploader(‘photo1′);
$path = Mage::getBaseDir(‘media’) . DS.’customer’.DS;
$logoName = $_FILES['photo']['name'];
$uploader->save($path, $logoName);

} catch (Exception $e) {


if (!$customer = Mage::registry(‘current_customer’)) {

$customer = Mage::getModel(‘customer/customer’)
->setPhoto($logoName) //Add this

Comments are closed.