I try to upload image in telligent, I got error response "Bad Request"

I try to upload the image in telligent, I got the error response "Bad Request". 

Kindly Help Us.

Parents
  • There are a few issues with your request.

    1. The request to api.ashx/v2/cfs is a GET which is used to retrieve an existing file, not upload a new file.
    2. The fileStore is expected to be an existing CFS file store name. It appears you are providing a local path.
    3. The path should just be a path within the fileStore defined. It appears you are sending a full local file path.

    The "Bad Request" response is because the URL formed with your parameters will not be recognized because the format of the parameters is incorrect (its not sending a valid fileStore or filePath).

    All that said, this endpoint/API doesn't do what you want--it is for retrieving files, not uploading.

    The upload endpoint documentation is here:  Upload Cfs REST Endpoint -- it allows the temporary uploading of a file that can then be referenced by the context and filename for use in other REST APIs. 

  • Hi,

    I try image uploaded, I got the error "No file was found in the request or the file could not be read", 

    I given FileName both , I got same error in response.

    'FileName': 'D://Newfolder//g6.png'

    or

    'FileName': 'g6.png'

    FYI,

    Velocity code:- 

    #set($stringResponse = $core_v2_uploadedFile.CreateContextId())

    Javascript:-

    jQuery.telligent.evolution.post({
    url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/cfs/temporary.json',
    data: {
    'UploadContextId': '$stringResponse',
    'FileName': 'D://Newfolder//g6.png'
    },
    success: function(response) {
    debugger;
    },
    error: function(xhr, desc, ex) {
    jQuery.telligent.evolution.notifications.show(ex, { type: 'danger', duration: 10000 });
    console.log(desc);
    console.log(ex);

    }
    });

    I need to upload an image in the rest API,  Can anyone share the code, please??

    Thanks & Regards,

    Sakthivel E

  • The upload handler does not accept a file name, it expects the file content. A full implementation of file uploading within a widget is available here:  Working with User-uploaded Files  

Reply Children