yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Upload multiple files in REST API PUT request #13958

Closed urfusion closed 7 years ago

urfusion commented 7 years ago

I am creating REST API on Yii2 and everything is working fine. But when I try to update the product images using Put request its not working well while working quit fine with POST request. I am using swagger for testing apis.

Below is the CURL request curl -X PUT --header 'Content-Type: multipart/form-data' --header 'Accept: text/html' --header 'Authorization: kapil 4p9mj82PTl1BWSya7bfpU_Nm8u07hkcB' -F name=TESTP11APR -F sku=SKUTESTP11APR -F short_description=short%20description -F description=long%20description -F sale_price=10.10 -F mrp_price=10.00 -F cost_price=8.00 -F category_id=1 -F product_type=1 -F brand_id=1 -F weight=1.2 -F stock_qty=1 -F status=1 -F sync=1%2C4 -F product_data=product%20information 'http://localhost/yiiconnect/products/426'

And the output is

Array ( [-----------------------------240363179620043 Content-Disposition:_form-data;_name] => "name"

TESTP11APR -----------------------------240363179620043 Content-Disposition: form-data; name="sku"

SKUTESTP11APR -----------------------------240363179620043 Content-Disposition: form-data; name="images"; filename="1.jpg" Content-Type: image/jpeg

???? )

yii-bot commented 7 years ago

Thank you for your question. In order for this issue tracker to be effective, it should only contain bug reports and feature requests.

We advise you to use our community driven resources:

If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.

This is an automated comment, triggered by adding the label question.