AnsweredAssumed Answered

Unexpected error using the webscript org/alfresco/repository/upload/

Question asked by germangq on Nov 8, 2018

 I cant use te REST service to upload a file from my own form made in a webscript in share. I tried to use ajax Alfresco.util.Ajax.request but the console return an error " 10080029 Unexpected error occurred during upload of new content" 

I tried to use the webscript "org/alfresco/repository/upload/"


The best way to help me should be with an example of using the example.
my code looks like this 

<div class="row">
<input type="text" name="nombre" id="nombre">
<input type="file" name="media" id="media">
<input type="button" id="sbmt">
$('#sbmt').click(function(e) {
var uploadFiles = document.getElementById('media').files;
var form = new FormData();
form.append("name", "amealoc");
form.append("nodeType", "cm:content");
form.append("filedata", uploadFiles[0]);
//var url = url += "?" + Alfresco.util.CSRFPolicy.getParameter() + "=" + encodeURIComponent(Alfresco.util.CSRFPolicy.getToken());
url: Alfresco.constants.PROXY_URI + "api/-default-/public/alfresco/versions/1/nodes/-root-/children" + "?" + Alfresco.util.CSRFPolicy.getParameter() + "=" + encodeURIComponent(Alfresco.util.CSRFPolicy.getToken()),
method: "POST",
mimeType: "multipart/form-data",
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + btoa('USR' + ":" + 'PASS'));
data: form,
async: true,
crossDomain: true,
processData: false,
contentType: false,
success: function(result, status, xhr) {
error: function(xhr, status, error) {