I want to send a file to my ajax Controller, but it sais "Undefined index: download_file"
I googled around for 2 hours but i cant understand the problem behind.
My View:
Ajax Controller:
when i change the file field to text and test something to output then everything works great.
i want to store a file in my ajax method.
well i could build a big workaround with own javascript code and everything but i dont understand the main problem here, why this seems not to be possible with the ajaxsubmitbutton?
thx
I googled around for 2 hours but i cant understand the problem behind.
My View:
<? $form = $this->beginWidget('CActiveForm', array('id' => 'input-form-adddownload', 'htmlOptions' => array('enctype' => 'multipart/form-data'))); ?> <input id="fileUploader" type="file" name="download_file" value=""> <?= CHtml::ajaxSubmitButton( 'Do it', array('ajax/SaveNewDownload'), array( 'type' => 'post', 'beforeSend' => 'function(){$("#error_download").html("loading...");}', 'success' => 'js:function(msg){$("#error_download").html(msg);}', ), array('class' => 'ans_submit_button', 'id' => 'btn_new') ); ?> <td><span id="error_download"></span></td> <?php $this->endWidget(); ?>
Ajax Controller:
public function actionSaveNewDownload() { print_r($_FILES["download_file"]); echo "test string"; }
when i change the file field to text and test something to output then everything works great.
i want to store a file in my ajax method.
well i could build a big workaround with own javascript code and everything but i dont understand the main problem here, why this seems not to be possible with the ajaxsubmitbutton?
thx