cancel
Showing results for 
Search instead for 
Did you mean: 

Java Automation Client - Upload change file name

Liam_Lyons
Champ in-the-making
Champ in-the-making

Hello, I am trying to upload a file using the java automation client :

FileBlob blob = (FileBlob) session.getFile(path); session.newRequest("Blob.Attach").setHeader(Constants.HEADER_NX_VOIDOP, "true").setInput(blob) .set("document", document.getPath().toString()).execute();

The file uploads fine, but doesnt keep his original name, instead, the file in the nuxeo server was uploaded as nx-automation-upload-xxxxxxxxxxx.tmp. All files i tried to upload are renamed with the prefix nx-automation-upload- and a .tmp extension.

Is there a way to upload files keeping original names and extensions on server?

1 REPLY 1

Liam_Lyons
Champ in-the-making
Champ in-the-making

I managed to do it :

document.set("file:filename",name); document = (Document) session.newRequest("Document.Update").setHeader(Constants.HEADER_NX_SCHEMAS, "*").setInput(document).set("properties", document).execute();

It works when I create a specific type of document (Picture, video, etc.) but not when I create a file, even if I put a picture in it for example. Anyone knows why ?