is it possible to save(POST, PUT) data along with uploading file on server using rest api?
Please elaborate.
Take a look here
@samdar:
Here is the example:
I have user table which has following fields
1) username 2) email 3) profile_image. Now creating a user by sending following params
{"username":"foo","email":"[email protected]"} on following url http://dev.app.com/api/web/v1/users (POST)which creates new user. but i also want to upload user profile image using same url which i don't know how to do.
let me know your thoughts on this.
@usualdesigner : thanks for the link but it is an alternative way to achieve what i want to do and infect i am using same method :)
You can use a model and UploadedFile class for solving your problem. Just create a model with file attribute, and assign it in your REST controller's action.
Here you can see the ready-to-use recipe for Yii 1.1:
http://www.yiiframework.com/wiki/2/how-to-upload-a-file-using-a-model/
It seems there's no issue and it fits more at forums.
Most helpful comment
Take a look here