0

I have created a form in frontend where sellers can fill their details but for brands logo, I want them to upload all the logos through a single input.How can I do that? Code: form- __('Brand Logo') ?>

Controller: foreach($_FILES["logopic"]["tmp_name"] as $key=>$tmp_name){ if(strlen($_FILES['logopic']['name'])>0){ $image = getimagesize($_FILES['logopic']['tmp_name']); if($image['mime']) { $img2 = rand(1,99999).$_FILES["logopic"]["name"]; $target= Mage::getBaseDir().'/media/Seller_Profile/BrandsLogo'; $uploader = new Mage_Core_Model_File_Uploader('logopic'); $uploader->setAllowedExtensions(array('gif','jpg','jpeg','png')); $uploader->setAllowCreateFolders(true); $uploader->setAllowRenameFiles(false); $uploader->setFilesDispersion(false);
$saved = $uploader->save($target,$img2); if($saved){
$value->setlogopic($img2); } }else{ Mage::getSingleton('core/session')->addError(Mage::helper('marketplace')->__("Disallowed file type.")); } } }

0

In HTML5 - edit input field

<input type="file" name="filefield" multiple="multiple">
  • I have tried this and added for loop in controller but the file is not saved – user49931 Apr 21 '17 at 12:34
  • But can You get files in $_POST ? – Martins Apr 21 '17 at 12:36
  • Didn't get you. Can you explain – user49931 Apr 21 '17 at 12:39
  • Need to check what You get in controller side $this->getRequest()->getParam('your-file-field-name') – Martins Apr 21 '17 at 12:41
  • wait let me upload the complete code!!!! – user49931 Apr 21 '17 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.