Status: Open
Status: Answered
Status: Closed
Status: Duplicate

Creating a file in an active WF attachment folder using REST

Posted Jun 09 by Hayden Ross.

I'm trying to use my file upload function to upload (post) a file to an active workflows attachment folder but it does not seem to work, here is my code (basically I pass the WF attachments folder's ID and the file I want to upload):

    function uploadFile(folderID, blob) {
             var fd = new FormData();
            fd.append( "type", "144" );
            fd.append( "parent_id", folderID);
            fd.append( "name", "test_file" );
            fd.append( "file", blob );
            console.log( "otcsticket for file upload is: " + otcsticket );
                type: "POST",
                url: eimpath + "/nodes",
                data: fd,
                contentType: false,
                processData: false,
                beforeSend: function( xhr ) {
                    xhr.setRequestHeader( "otcsticket", otcsticket ),
                    xhr.overrideMimeType( "multipart/form-data" )
                }).done(function( data ) {
                    console.log( data );
                }).fail(function( request, statusText ) {
                    console.log( statusText );

this produces a 400 error. If a sub-folder is in the WF attachments folder and I pass the sub-folders ID instead the upload works, so I'm wondering if there is any other method to posting a document to the root of the WF attachment folder (I can use "get" to get back information on this node and its children).

1 Answer

BEST ANSWER: As chosen by the author.

same issue.

 You have subscribed and will receive email notifications of updates to this topic. To unsubscribe, uncheck the checkbox.


Related categories

Related tags

Your answer

To leave an answer, please sign in.