priority-web-sdk: uploadImage

Viewed 60

I'm trying to upload an image using uploadImage from the documentation. The first thing I notice is that the method does not seem to be exposed by the package.

There is a method with a very similar signature uploadDataUrl, which I'm using in the code below, but I can't tell if the usage is identical.

There's a full example of my test page here.

save(curform) {
    return new Promise((resolve, reject) => {
        curform.uploadDataUrl("{0}{1}".f(this.postURL, this.filename), "png").then(uploadResult => {
            if (uploadResult.isLast == 1) {
                // Save the upload result with fieldUpdate.

            } else {
                var er = {};
                er.message = "Don't know what happened...";
                reject(er);
            }

        }).catch(er => { reject(er) })
    })
}

The FileUploadResult looks like this:

JSONObject {jsObject: Object, progress: 100, isLast: false}

Obviously if the upload was successful there should be file.Key and file.Value in the FileUploadResult.

Any suggestions please?

1 Answers
Related