0

I am trying to upload file using QBCustomObjectFiles ,uploading starts to show progress in log cat ,but with file field is null and response throws error like this '{"errors":["The resource wasn't found"]}'

I checked My Note Class on Quickblox admin panel,everything seems OK.Also I checked the file (field in method parameter) and it is not null as showing in log cat

public void uploadNote(Note note, File file, 
QBEntityCallback<QBCustomObjectFileField> callback, QBProgressCallback 
 progressCallback) {
    QBCustomObject customObject = new QBCustomObject();
    customObject.setClassName(Note.Contract.CLASS_NAME_NOTE);
    customObject.put(Note.Contract.COURSE_ID,note.getCourseId());
    customObject.put(Note.Contract.CATEGORY_ID,note.getCategoryId());
    customObject.put(Note.Contract.DESCRIPTION,note.getDescription());
    customObject.put(Note.Contract.TOPIC,note.getTopic());
    QBCustomObjectsFiles.uploadFile(file, customObject, "noteFile", progressCallback).performAsync(callback);

}

This is my log cat :

REQUEST POST https://api.quickblox.com/data/Note/null/file.json HEADERS QuickBlox-REST-API-Version=0.1.1 QB-SDK=Android 3.9.1 QB-Token=011a2bc55be67185d4d045d8b2d31 PARAMETERS field_name=noteFile INLINE POST https://api.quickblox.com/data/Note/null/file.json?field_name=noteFile

and this is response

      '{"errors":["The resource wasn't found"]}'

The Uploading starts and shows progress ,but after progress 100 it throws above error.

paul
  • 3
  • 4

1 Answers1

0

You should use QBContent instead of QBCustomObjectsFiles. Example:

QBContent.uploadFileTask(file, isPublic, tags, new QBProgressCallback() {
            @Override
            public void onProgressUpdate(int progressValue) {
                //some code for progress
            }
        }).performAsync(new QBEntityCallback<QBFile>() {
            @Override
            public void onSuccess(QBFile qbFile, Bundle params) {
                //some code for success upload
            }

            @Override
            public void onError(QBResponseException responseException) {
                //some code for error upload
            }
        });
QuickBlox
  • 233
  • 1
  • 11