I assume that RESTful services is a comprehensive paradigm, that it also could cover file uploads too, as a subset of http operations.
If so, how does one do file uploads in Rest and specifically, with Zend_Service_Rest?
Should my client code somehow 开发者_StackOverflowread the file and assign its content to some property of restful object? Or there is another way?
you don't need to use Zend_Service_Rest
to play with REST, having a simple controller and checking what verb has been used could also make it.
Zend_Service_Rest
is just here to show one implementation but in my opinion the way of passing arguments is too restrictive. I prefer to code my own controller so I have more control.
if you are using PUT
for uploading file you could do something like that
public function foobarAction(){
$request = $this->getRequest();
$this->_helper->viewRenderer->setNoRender()
if($request->isPut()){
//DOSOMETHING with $_FILES
}
}
精彩评论