Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

uploading file
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

how can i upload my file using API ?

thanks before

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

can anybody help me , please ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
PandaWebStudio
Member
 
Avatar
Total Posts:  40
Joined:  2008-04-19
Amsterdam, Netherlands
 

http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product_attribute_media#catalog_product_attribute_media.create

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

thanks for your reply

I’ve got it

$tmpDirectory Mage::getBaseDir('var') . DS 'api' DS 'example';
        
$ioAdapter = new Varien_Io_File();
        
$fileContent = @base64_decode($files['fileContent']true);
        
$fileName $date'_' .$files['uploadedfile']['name'];
        
        try 
{
            $ioAdapter
->checkAndCreateFolder($tmpDirectory);
            
$ioAdapter->open(array('path' => $tmpDirectory));
            
$ioAdapter->write($fileName$fileContent0666);
            unset(
$fileContent);
        
catch (Mage_Core_Exception $e{
            $this
->_fault('not_created'$e->getMessage());
        
catch (Exception $e{
            $this
->_fault('not_created'Mage::helper('catalog')->__('Can\'t create image.'));
        }
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top