0

In system.xml file you can upload images to /media/... by using:

<upload_dir config="system/filesystem/media" scope_info="1">modulename/folder</upload_dir>
<base_url type="media" scope_info="1">modulename/folder</base_url>

However i need to upload the image in skin/frontend/modulename/themename/css/images directory. I've tried with config="system/filesystem/skin" and type="skin" but it doesn't work.

1 Answer 1

2

Before I explain how you can achieve this I want to say that I don't approve of the upload of resources in folders other than media. Your Magento instance should only write files to media and var.

But if you insist.....

You can't do much only my changing the upload_dir and base_url tags.
The config input has the <backend_model> a class that extends Mage_Adminhtml_Model_System_Config_Backend_File.
And in that class there is this method that determines the base folder where the file will be uploaded.

protected function _getUploadRoot($token)
{
    return Mage::getBaseDir('media');
}

This means that everything is uploaded somewhere inside the media folder.
So you need to create a backend model that extends the original one and change the method I mentioned above

Your Answer

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

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