Adding a File Upload Field to the Magento System.xml Configuration

[xml]
<upload_file translate=”label tooltip comment”>
<label>Upload File</label>
<comment>Add comments here</comment>
<tooltip>Add a tooltip that appears on hover</tooltip>
<frontend_type>file</frontend_type>
<backend_model>adminhtml/system_config_backend_file</backend_model>
<upload_dir config=”system/filesystem/media” scope_info=”1″>admin-config-uploads</upload_dir>
<base_url type=”media” scope_info=”1″>admin-config-uploads</base_url>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</upload_file>
[/xml]

sets the upload location for the file. In the above example, the file will be saved in a sub-folder under the media folder. e.g. /media/admin-config-uploads/. To get the full URL / link to the file from the above example, you can use the following code:

[php]
<?php
echo Mage::getBaseUrl(‘media’) . Mage::getStoreConfig(‘system_config_name/group/upload_file’);
?>
[/php]

Be sure that the media folder has write permission and you replace system_config_name and group with your actual variables.