cancel
Showing results for 
Search instead for 
Did you mean: 

uploading content

tog
Champ in-the-making
Champ in-the-making
Hi,

I know there is a web service interface to alfresco but I was wondering if it was possible to upload content using either a command line (curl for example) or by doing a POST request to the server ?

Cheers
Tog
19 REPLIES 19

bremmington
Champ on-the-rise
Champ on-the-rise
I am also interested in this. The WebScriptRequest doesn't provide access to the underlying input stream. I can't see a way of gaining access to it under the covers either. Can anyone suggest a way of getting it, or give a good reason why one shouldn't get it?


Regards
Brian

jpfi
Champ in-the-making
Champ in-the-making
Hi,
there is a UploadContentServlet: http://wiki.alfresco.com/wiki/URL_Addressability#UploadContentServlet
Cheers,
Jan

mikeh
Star Contributor
Star Contributor
Or you can roll your own Web Script, which allows you to pass in arbitrary metadata in the same HTTP request:
http://wiki.alfresco.com/wiki/Web_Scripts_Examples#File_Upload

Thanks,
Mike

bremmington
Champ on-the-rise
Champ on-the-rise
Great. Thank you both very much.


Regards
Brian

tog
Champ in-the-making
Champ in-the-making
Hi Mike,
Actually, the doc said it is available in Enterprise edition. I downloaded a trial enterprise version but was not able to find this sample.
Can someone help me on this ?

Best Regards

mikeh
Star Contributor
Star Contributor
The sample doesn't ship with the product - just create it yourself from the wiki text.

Thanks,
Mike

tog
Champ in-the-making
Champ in-the-making
Ok I see, thanks for your quick answer.
So what prevent me to use it with the community edition ? - I would feel more comfortable if I can do my mock up with this version and move afterwards to an enterprise edition.

Thanks

mikeh
Star Contributor
Star Contributor
You might find one of the JavaScript APIs is missing in 2.1 Community. It'll be in v2.9 though. Try it and see what happens!  Smiley Very Happy

Mike

tog
Champ in-the-making
Champ in-the-making
Thanks Mike,
I implemented what I found on the wiki.
When I try to run it I am denied the rights to run the script with this error:
I might be missing something here 😉

Best Regards

Message:   Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/org/alfresco/sample/upload.post.js': Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/org/alfresco/sample/upload.post.js': Wrapped org.alfresco.repo.security.permissions.AccessDeniedException: Access Denied. You do not have the appropriate permissions to perform this operation. (AlfrescoScript#34)

Exception:   net.sf.acegisecurity.AccessDeniedException - Access is denied.
   
   net.sf.acegisecurity.vote.AffirmativeBased.decide(AffirmativeBased.java:86)
   net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:394)
   net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
   org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   $Proxy44.create(Unknown Source)
   org.alfresco.repo.jscript.ScriptNode.createFile(ScriptNode.java:1237)