Very Slow uploading files via API to external server - invokeurl

Very Slow uploading files via API to external server - invokeurl

Hello!
I developed my own function to upload the related files on a lead via API using invokeurl.
If I upload a file bigger than 80 kbytes sometimes it returns a timeout and sometimes ir works. Seems to be a uploading speed problem.

I have tested it using postman with a 20MB file and works extremely fast.

Is there anything somebody could check?

Code pointing a sandbox server:

header_data = Map();
header_data.put("Authorization","Basic NGIwZGE5YmY4ODlkOTZlZDFmYjFlNzU1YTZjZmVlYWI6MzY5YmEzMzczYzEwNzMzNTVjNWExZjExZjg1ODBhOGQ=");
//
//CREA LOS FICHEROS
fichero = Map();
fichero.put("customer_id",customer_id);
fichero.put("type","uploaded");
fichero.put("title","titulo");
fichero.put("description","");
fichero.put("visible_by_customer",1);
subir = invokeurl
[
url :url_crear_fichero
type :POST
parameters:fichero
headers:header_data
];
id_documento_creado = subir.getJson("id");
info id_documento_creado;
//
//
// SUBE LOS FICHEROS A SPLYNX
//
//
attachments = zoho.crm.getRelatedRecords("Attachments","Contratos_de_servicio",id_contrato);
if(attachments.size() > 0)
{
for each  file in attachments
{
downloadFile = invokeurl
[
url :"https://www.zohoapis.eu/crm/v2.1/Contratos_de_servicio/" + id_contrato + "/Attachments/" + file.get("id")
type :GET
connection:"modules"
];
}
}
downloadFile.setParamName("file");
fichero_final = Map();
fichero_final.put("file",downloadFile);
//REQUEST UPLOAD THE FILE
//
header_data = Map();
header_data.put("Authorization","Basic NGIwZGE5YmY4ODlkOTZlZDFmYjFlNzU1YTZjZmVlYWI6MzY5YmEzMzczYzEwNzMzNTVjNWExZjExZjg1ODBhOGQ=");
customer_api_url = "http://195.7.12.90/api/2.0/admin/customers/customer-documents/" + id_documento_creado + "--upload";
customer_response = invokeurl
[
url :customer_api_url
type :POST
parameters:fichero_final
headers:header_data
];
info customer_response;
info downloadFile;
info fichero_final;
//
//
//
return "";