Hey!
I was trying to upload a file ala "ajax" (via iframe) using jquery
form plugin (http://malsup.com/jquery/form/#file-upload), this plugin
use the iframe technique to upload files and then get the response
printed in the iframe, what's the problem? by default the json action
helper sets the content-type header to application/json and when the
response is sent a download popup shows up with the json string, seems
like you can't override the default content-type :S so I fix it with
this:
public action loadFileAction()
{
if ( true === empty( $_FILES["archivo"]["tmp_name"] ) )
{
Ceiba_Error::getInstance()->add( "Por favor agregue un archivo" );
$data = Zend_Json::encode( array( "errors" =>
Ceiba_Error::getInstance()->getErrors() ) );
$this->getResponse()->setHeader( "Content-Type", "text/plain" )
->setBody( $data );
// ->sendResponse();
return true;
}
}
How to override the default json action helper content-type header?
would be nice to add a setter to achive this.
Thanks.