1

It's been a while since I want a way to add file upload system when creating a payment method.

In a custom module , I created a new method of payment. When declaring my fields in the file "system.xml" I'll wish to add an input to upload a PDF. Here is part of my code :

<bvr translate="label" module="paygate">
   .......
   ....
   <fields>
      <bvrfile translate="label">
         <label>BVR file</label>
         <frontend_type>file</frontend_type>
         <sort_order>2</sort_order>
         <show_in_default>1</show_in_default>
         <show_in_website>1</show_in_website>
         <show_in_store>0</show_in_store>
      </bvrfile>
    </fields>
    .......
    ....
</bvr>

Here is a screenshot of my admin panel: enter image description here

Do you know if it is possible to add this type of field and how I can retrieve the file's URL upload?

1 Answer 1

3

File will be saved in the media folder.

you have to specify the file path in system.xml by following code

<backend_model>adminhtml/system_config_backend_file</backend_model>
<upload_dir config="system/filesystem/media/" scope_info="1">admin-config-uploads</upload_dir>

here the file will be save in the root/media/<store_code>/admin-config-uploads/

so to get the file path use the following code

<?php
    echo Mage::getBaseUrl('media') . 'admin-config-uploads'.Mage::getStoreConfig('system_config_name/group/upload_file');
?>

Refer this link

1
  • Thanks a lot, it works like an hot cake !! ;) I'm not able to change the destination folder like you describe. but it does not matter. thanks a lot for your reply & your help
    – Flow
    Jun 26, 2015 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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