Rumi
Rumi

Reputation: 229

Cannot Upload file to Alfresco with Curl

I have a php script that uploads files to Alfresco using curl, it works fine with local setup of Alfresco on my system. But, fails when the same is used to upload to production copy.

Below, is the curl response upon failure while uploading file,

{
  "status" :
{
  "code" : 500,
  "name" : "Internal Error",
  "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
},

"message" : "00031437 Unexpected error occurred during upload of new content.",
"exception" : "org.springframework.extensions.webscripts.WebScriptException - 00031437 Unexpected error occurred during upload of new content.",

"callstack" :
[
   ""      ,"java.lang.IllegalArgumentException: Class {}application\/pdf has not been defined in the data dictionary"
  ,"org.alfresco.repo.policy.ClassPolicyDelegate.get(ClassPolicyDelegate.java:98)"
  ,"org.alfresco.repo.policy.ClassPolicyDelegate.get(ClassPolicyDelegate.java:83)"
  ,"org.alfresco.repo.node.AbstractNodeServiceImpl.invokeBeforeCreateNode(AbstractNodeServiceImpl.java:283)"
  ,"org.alfresco.repo.node.db.DbNodeServiceImpl.createNode(DbNodeServiceImpl.java:363)"
  ,"sun.reflect.GeneratedMethodAccessor1147.invoke(Unknown Source)"
  ,"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
  ,"java.lang.reflect.Method.invoke(Method.java:606)"
  ,"org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)"
  ,"org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)"
  ,"org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)"
  ,"org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:104)"
  ,"org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)"
  ,"org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)"
  ,"com.sun.proxy.$Proxy9.createNode(Unknown Source)"
  ,"sun.reflect.GeneratedMethodAccessor1147.invoke(Unknown Source)"
  ,"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
  ,"java.lang.reflect.Method.invoke(Method.java:606)"
  .
  .
  .
}

Any idea?

Upvotes: 1

Views: 1466

Answers (1)

Andreas Steffan
Andreas Steffan

Reputation: 6159

The value of contenttype must be a valid type qname. Have a look at the documentation at http://WEBURL:8000/alfresco/service/index/uri/api/upload. If in doubt, try cm:content or it's full representation.

Upvotes: 2

Related Questions