Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot upload images in magento
    text
    copied!<p>I have a custom module by which i am trying to upload images. However i cant upload images </p> <p>This is my form file</p> <pre><code>&lt;?php &lt;form id="imageform" method="post" action="&lt;?php echo $this-&gt;getFormAction(); ?&gt;"&gt; &lt;input type="file" id="chain_Image" value="" name="Image[]" class="input-text"&gt; &lt;/form&gt; </code></pre> <p>note that this is only a small part of my code. actually this form can contain any number images. that is we can upload more than one image at a time.</p> <p>This is my saveAction() :</p> <pre><code> &lt;?php $arr = $this-&gt;getRequest()-&gt;getPost('Image'); foreach($arr as $image) { if(isset($_FILES[$image]['name']) and (file_exists($_FILES[$image]['tmp_name']))) { try { $path = Mage::getBaseDir('media') . DS . 'banner' . DS; $uploader = new Varien_File_Uploader($image); $uploader-&gt;setAllowedExtensions(array('jpg','png','gif','jpeg')); $uploader-&gt;setAllowRenameFiles(false); $uploader-&gt;setFilesDispersion(false); $destFile = $path.$_FILES[$image]['name']; filename = $uploader-&gt;getNewFileName($destFile); $uploader-&gt;save($path, $filename); $postData['Image'] = $_FILES[$image]['name']; } catch(Exception $e) {} } else { if(isset($postData[$image]['delete']) &amp;&amp; $postData[$image]['delete'] == 1) $postData[$image] = ''; else unset($postData[$image]); } } $bannerModel-&gt;addData($postData)-&gt;setId($this -&gt;getRequest()-&gt;getParam('id'))-&gt;save(); </code></pre> <p>However it does not upload my imaged. $_FILES is seem to be empty,when i have printed this. What is the problem in my code. Help me. Thanks in advance !!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload