Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty file on wordpress gallery uploadFile #60

Open
devcosta opened this issue Aug 1, 2018 · 3 comments
Open

Empty file on wordpress gallery uploadFile #60

devcosta opened this issue Aug 1, 2018 · 3 comments

Comments

@devcosta
Copy link

devcosta commented Aug 1, 2018

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

@scottgonzalez
Copy link
Owner

Does this example work for you?

@devcosta
Copy link
Author

devcosta commented Aug 1, 2018

I saw this example but doesn't work

@Baronsindo
Copy link

i cant upoad all the images some images, get uploaded quick and smooth but others return no data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants