Skip to content

Empty file on wordpress gallery uploadFile #60

Description

@devcosta

hi guys, i send a new file with client.uploadFile but the file of wordpress gallery is empty

Here my code:

const fs = require( "fs" );
const client = wordpress.createClient....

const file = fs.readFileSync(fileLocation);

const uploadOptions = {
 name: fileName,
 type: 'image/jpeg',
 bits: file,
};

client.uploadFile(uploadOptions, function (error, fileData) {
    console.log(fileData.attachment_id); //83
    console.log(fileData.metadata.file); //undefined
    console.log(fileData.file); //abvatygaq06.jpg
});
Node version: v10.4.0
Node-wordpress: 1.4.1
Wordpress version 4.9.7

wordpress

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions