You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by pi...@wipro.com on 2010/03/09 10:49:00 UTC

Image upload using POST method

Hi,

I am trying to upload a image through form upload POST method using the
following code :

<body>
<FORM id="image" target="_self" METHOD="POST"
ENCTYPE="multipart/form-data"
ACTION="http://localhost/shindig/social/rest/ImageHandler/upload">
File to upload: <INPUT id ="image" TYPE=FILE NAME="upfile"><BR>
<INPUT TYPE=SUBMIT VALUE="Submit" onClick="update();">
</FORM>
</BODY>

I have written a handler named ImageHandler to receive the image and
process it. 

But when I do form submit I get a response 

HTTP Status 400 - Unsupported Content-Type multipart/form-data. One of
application/json, text/x-json, application/javascript,
application/x-javascript, text/javascript, text/ecmascript,
application/json-rpc, application/jsonrequest, text/xml,
application/xml, application/atom+xml is required
But multipart/form-data is allowed content type in shindig. Do I need to
pass any extra parameters. Suggestions will be helpful.


Thanks,
Pinky Muralidhar.


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com

Re: Image upload using POST method

Posted by Paul Lindner <li...@inuus.com>.
I didn't see specific multipart support in the REST spec.   There is in the
json-rpc handler, but that's not a solution for what you're trying to do
here..  You can loosen things up by changing this shindig.properties
setting:

# true to force strict content type checking for requests made to API
endpoints.
# E.g. require application/json for JSON-RPC
shindig.api.disallow-unknown-content-types=true

On Tue, Mar 9, 2010 at 2:49 AM, <pi...@wipro.com> wrote:

>
> Hi,
>
> I am trying to upload a image through form upload POST method using the
> following code :
>
> <body>
> <FORM id="image" target="_self" METHOD="POST"
> ENCTYPE="multipart/form-data"
> ACTION="http://localhost/shindig/social/rest/ImageHandler/upload">
> File to upload: <INPUT id ="image" TYPE=FILE NAME="upfile"><BR>
> <INPUT TYPE=SUBMIT VALUE="Submit" onClick="update();">
> </FORM>
> </BODY>
>
> I have written a handler named ImageHandler to receive the image and
> process it.
>
> But when I do form submit I get a response
>
> HTTP Status 400 - Unsupported Content-Type multipart/form-data. One of
> application/json, text/x-json, application/javascript,
> application/x-javascript, text/javascript, text/ecmascript,
> application/json-rpc, application/jsonrequest, text/xml,
> application/xml, application/atom+xml is required
> But multipart/form-data is allowed content type in shindig. Do I need to
> pass any extra parameters. Suggestions will be helpful.
>
>
> Thanks,
> Pinky Muralidhar.
>
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain proprietary, confidential or privileged information. If you are not
> the intended recipient, you should not disseminate, distribute or copy this
> e-mail. Please notify the sender immediately and destroy all copies of this
> message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>