1

in magento admin dashboard i unable to upload image due to flash player down. Please advise the option for adding of product images.

1
0

This appears to be a duplicate question

Answer:

Flash uploader was removed to being insecure and replaced with javascript uploader. Please apply the correct patch 8788 or update the store to 1.9.4.5 / OpenMage Project to avoid further disruption.

0

I just built a basic Node.js CLI tool for image uploading based on this repo/module. This is for a legacy install that is still running 1.5x and is full of gremlins that prevent patching from working properly. It uses the old SOAP API.

I used Commander to add CLI options.

I used Pkg to create executables.

It's a pretty simple project that allows non-technical users to quickly add images to a product by SKU.

'use strict';

const Mage = require('./node_modules/magento');
const fs = require('fs');
const path = require('path');
const { program } = require('commander');

program
    .version('0.1')
    .option('-s, --sku <sku>', 'Base SKU to upload to')
    .option('-f, --file <file>', 'Image filename')
    .option('-l, --label <label>', 'Image label')

program.parse(process.argv);;
const options = program.opts();

function mageUpload() {
    
    var session = new Mage({
        host: 'www.example.com',
        port: 80,
        path: '/api/xmlrpc',
        login: 'yourlogin',
        pass: 'yourpassword'
    })
    return session.login(function(err, sessId) {
        if (err) {
            console.log('error on login', err);
            return;
        }
        
        var filename = options.file;
        var image = fs.readFileSync(filename);
        var base64img = image.toString('base64');

        session.catalogProductAttributeMedia.create({
           product: options.sku,
           data: {
               file: {
                   content: base64img,
                   mime: 'image/jpeg',
                   name: path.parse(filename).name
               },
               label: options.label,
               types: [],
               exclude: '0'
           }
        }, function(self, result) {
            console.log(self);
            console.log(result);
        })

    })
}

mageUpload();
1
  • Just going to add that there is a bug with this approach and I haven't tracked it down precisely yet. It may be related to the xmlrpc dependency of the magento npm module, or it might just be a server resource configuration error. When I upload images over a certain size, I get an error coming from xmlrpc unable to parse the TITLE element, which tells me that the SOAP API response is throwing some kind of error and it's in the form of an HTML page, which cannot be parsed properly by xmlrpc. I suspect the PHP config has some inadequate resources configured. – pspahn Jan 20 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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