...hmmm, your alfresco and alfresco-js-api version is?
Alfresco Community v5.2.0
"alfresco-js-api": "^1.5.0"
Okay, I managed to create a file using REST, doing few changes :
In var options :
'headers': {
'Content-Type': 'application/json'
}
Also, the path to upload :
options.path = '/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?alf_ticket='+JSON.parse(chunk).data.ticket
But I still don't know how to upload an existing file
Okay so I figured out how to upload a File, once logged and var ticket initialized :
var request = require('request')
var fs = require('fs')var r = request.post('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?alf_ti..., function callback(err, httpResponse, body) {
if(err || JSON.parse(body).error) {
return console.log('Upload failed : ' + body)
}
console.log('Upload success')
})var form = r.form()
form.append("name", "testFile.txt")
form.append("nodeType", "cm:content")
form.append("relativePath", "Sites/test-site/documentLibrary")
form.append("filedata",fs.createReadStream('./testFile.txt'))
I don't use alfresco-js-api anymore
Hi Alexandre,
sorry I had no time to answer - I'm using alfresco-js-api with angularJS clients but didn't use the upload function until now (migrating from old stuff, upload is still the old code).
I had some login issues with alfresco-js-api, but after asking under the adf section of alfresco community, my problems were solved in no time.
If you are interested, I will share my experience when using (or trying to use) the upload-function - but this won't be before July.
It would be helpful if you could share your experience in July.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.