cancel
Showing results for 
Search instead for 
Did you mean: 

Upload document using Alfresco Android SDK (always 0KB)

mcasanket
Champ on-the-rise
Champ on-the-rise
Hi All,

I am trying to upload a file using alfresco android sdk. I am having sdk 1.3 version. When I upload any file from my Android mobile to Alfresco it works fine but when I go and check the file in explorer or share the file size is always 0KB.

I am using windows 7 and Alfresco 4.1.4 (r49301-b80)version.



Map<String, Serializable> properties = new HashMap<String, Serializable>();      
            
ContentFileImpl file = new ContentFileImpl(new File("file:///mnt/sdcard/test.txt"));
            
properties.put(ContentModel.PROP_NAME, destination.getName());
            
Log.e("Parent ", "" +destination.getName() +"  == " +file.getFileName()); // prints proper names
            
documentFolderService.createDocument((Folder) destination, file.getFileName(), properties, file);  // Runs without any error




Please help!
2 REPLIES 2

jm_pascal
Star Contributor
Star Contributor
Aloah,

I have a doubt on your file path. I'm not sure "file://" prefix is accepted and returns the file.
Could you check if your file object exists first and which length it has

Thanks.

Thanks jm.pascal,

It works. The path should be without "file:///" prefix.

Thanks a lot!