AnsweredAssumed Answered

upload.post.js unable to get fields from formdata

Question asked by calebmei on Apr 24, 2009
Latest reply on Nov 6, 2009 by rpldcox
Hi there,

I apologize if this question was asked before, but I couldn't find similar question and answer from previous posts.

I am trying to use Java to upload content via,
   
POST /service/api/upload
with the request body attached below.

However, upload.post.js is unable to get any field from formdata. When I try to print all the fields in formdata using this,
for each (field in formdata.fields) {
        status.message += " " + String(field.name);
      }

There is no fields in the formdata.

My understanding is that this is not an authentication issue, because without alf_ticket, I am getting 401 error. This issue is also unlikely to be similar /service/sample/upload, which requires permission on the user from the subspace. This issue's script is located in tomcat directory.

Is there some special setting I need to set the header of the request?
Is there  a way for me to trace the issue on why alfresco is not passing the formdata to the upload.post.js?
Anyone have similar issue?

Thanks in advance and really appreciate for any assistance.  :)

Cheers,
Calebmei


Here's the request body with multipart form:

POST /service/api/upload
Content-Type: multipart/form-data; boundary=3673886725790367917

—3673886725790367917
Content-Disposition: form-data; name="containerid"

26a0569c-c056-4997-bbb4-67f81ec6695b
—3673886725790367917
Content-Disposition: form-data; name="nodeid"

26a0569c-c056-4997-bbb4-67f81ec6695b
—3673886725790367917
Content-Disposition: form-data; name="ticket"

TICKET_8950a48fe1117b4c32f359a06c514bd4c4f70d7c
—3673886725790367917
Content-Disposition: form-data; name="title"

test2.txt
—3673886725790367917
Content-Disposition: form-data; name="filename"

test2.txt
—3673886725790367917
Content-Disposition: form-data; name="siteid"
localhost

—3673886725790367917
Content-Disposition: form-data; name="submit"

Upload
—3673886725790367917
Content-Disposition: form-data; name="filedata"; filename="c:\test2.txt"
Content-Type: text/plain

[actual content here]
—3673886725790367917

Outcomes