I'm developing a module with both a frontend and a backend. Until now everything has been ok, but now I want to upload images in the backend. I don't know how to start, and everything I've tried has just given me a headache.
Thanks
I'm developing a module with both a frontend and a backend. Until now everything has been ok, but now I want to upload images in the backend. I don't know how to start, and everything I've tried has just given me a headache.
Thanks
This needs to go into your module's etc/system.xml
file:
<?xml version="1.0"?>
<config>
<sections>
<imagesection> <!-- Make up a section key (configuration sidebar) -->
<!-- ... -->
<groups>
<imagegroup> <!-- Make up a group key (the part you can expand/collapse) -->
<!-- ... -->
<fields>
<imagefield> <!-- Make up a field key -->
<label>Field Name</label>
<frontend_type>image</frontend_type>
<backend_model>adminhtml/system_config_backend_image</backend_model>
<upload_dir config="system/filesystem/media" scope_info="1">uploaddir</upload_dir> <!-- would upload into media/uploaddir -->
<base_url type="media" scope_info="1">uploaddir</base_url> <!-- same as previous line -->
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</imagefield>
after a few days of research, here is an easy to use example of how you can upload files in magento how_to_create_pdf_upload_in_backend_for_own_module