无法使用Curl将文件上载到Alfresco
我有一个php脚本,可以使用curl将文件上传到Alfresco,它可以在我的系统上与Alfresco的本地设置配合使用。但是,在将相同的文件上载到生产副本时失败 下面是上传文件失败时的curl响应无法使用Curl将文件上载到Alfresco,alfresco,alfresco-share,Alfresco,Alfresco Share,我有一个php脚本,可以使用curl将文件上传到Alfresco,它可以在我的系统上与Alfresco的本地设置配合使用。但是,在将相同的文件上载到生产副本时失败 下面是上传文件失败时的curl响应 { "status" : { "code" : 500, "name" : "Internal Error", "description" : "An error inside the HTTP server which prevented it from fulfilling th
{
"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)"
.
.
.
}
有什么想法吗?contenttype的值必须是有效的类型名称。请查看
http://WEBURL:8000/alfresco/service/index/uri/api/upload
。如果有疑问,请尝试cm:content
或其完整表示 根据给出的信息很难判断。似乎系统试图使用mime类型作为本地qname创建节点。我猜您发送的数据与watch Alfresco的预期不太相符。您将哪些数据/参数发送到哪个地址(URL)?下面是我使用的代码,在Alfresco的本地副本上运行良好。但是,在生产服务器上抛出错误<代码>$url=http://admin:passwd@WEBURL:8000/alfresco/service/api/upload'$文件名='john.jpeg'$mimetype=mime\u content\u type($filename)$postfields=array('filedata'=>'@'.$filename',filename'=>$filename,'siteid'=>'mysite','containerid'=>'documentLibrary','uploaddirectory'=>'test','contenttype'=>$mimetype)代码>很难说为什么,但看起来$mimetype的值是“application/pdf”,使用它作为contenttype是错误的。仔细检查你传递的内容。如果此值在您的系统上真正起作用,则可能您(意外地)创建了一个本地名称为“application/pdf”且没有namespace.Fixed的内容类型。刚刚从post字段中删除了内容类型。