cancel
Showing results for 
Search instead for 
Did you mean: 

fileupload mime type

lpiccoli
Champ in-the-making
Champ in-the-making
hi all

my current test code is successfully upload files to the alfresco via the CMIS atom protocol.
however i have a few questions.



public void setDocuement( String name ){
Entry entry = abdera.newEntry();
        entry.setTitle(name);
        entry.setSummary("Summarize summarize…");

        CMISObject cmisObject = entry.addExtension(CMISConstants.OBJECT);
        CMISProperties properties = cmisObject.addExtension(CMISConstants.PROPERTIES);
        CMISProperty property = properties.addExtension(CMISConstants.PROPERTY_STRING);
        property.setAttributeValue(CMISConstants.PROPERTY_NAME, CMISConstants.PROP_OBJECT_TYPE_ID);
        Element value = property.addExtension(CMISConstants.PROPERTY_VALUE);
        value.setText("document");

        InputStream in = null;
      try {
         in = new FileInputStream( "c:/temp/test.pdf");
         entry.setContent(in, "application/pdf");
         
      } catch (FileNotFoundException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }

Q1.does the file being upload need to have the explicit mime type set?
if so what is the typically strategy to cater for many file types available?

Q2. It is not clear from the spec where the content stream can be.

CMIS Part II – REST-Atom Binding v0.5.pdf

setContentStream

This method follows the Atom Publishing model where the media (content stream) is PUT at the edit-media or stream link.

what does that mean?

I am current placing the content stream within a content block. is there more efficient options?


many thanks

-lp
1 REPLY 1

lpiccoli
Champ in-the-making
Champ in-the-making
i will answer my own question here.

Q1.does the file being upload need to have the explicit mime type set?
if so what is the typically strategy to cater for many file types available?

by setting the mime type to


application/octet-stream

and ensuring the file name has the correct extension (.pdf, .txt. etc)

this seems to work for all the file extensions that i tried.
Hence the mime type only needs to be "application/octet-stream" and alfresco seems to take care of the rest when retrieving document.



-lp