upload obrázkov hlási session error
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- DOBss
- Člen | 24
Zdravím,
mám formulár, ktorý odosiela až 44+ obrázkov a po jeho odoslaní nette hlási túto podivnú chybu:
Ak vypnem developer mode, tak nahrá prvých 20 obrázkov a skončí to bez problémov. V error logu však vyskakujú tieto dve chyby:
[2014-04-17 09-55-02] PHP User Notice: Possible problem: you are starting session while already having some data in output buffer. This may not work if the outputted data grows. Try starting the session earlier. in /var/www/vhosts/lvps178-77-74-72.dedicated.hosteurope.de/psdcoding.sk/sub/iloveny/vendor/nette/nette/Nette/Http/Session.php:543 @ http://iloveny.psdcoding.sk/slider/edit/14?do=sliderForm-submit
[2014-04-17 09-55-02] PHP User Notice: Possible problem: you are sending a HTTP header while already having some data in output buffer. Try OutputDebugger or start session earlier. in /var/www/vhosts/lvps178-77-74-72.dedicated.hosteurope.de/psdcoding.sk/sub/iloveny/vendor/nette/nette/Nette/Http/Response.php:315 @ http://iloveny.psdcoding.sk/slider/edit/14?do=sliderForm-submit
dumpy som z kódu celkom odstránil, čiže to by nemal byť problém. Prosím niekto nejaké nápady??
kód formulára je nasledovný:
public function createComponentSliderForm(){
$form = new Form;
$form->addText('name', 'Name:')
->setAttribute('placeholder', 'Slides set #ID (default)');
$form->addText('activeFrom', 'Active from:')
->setAttribute('placeholder', 'NOW (default)');
$form->addDynamic('slides', function (Nette\Forms\Container $slides){
$slides->addText('headline', 'Headline:')
->addRule(Form::REQUIRED, 'Please fill in headline.');
$slides->addTextArea('text', 'Text:')
->addRule(Form::REQUIRED, 'Please fill in text.');
$slides->addText('link', 'Target:')
->getControlPrototype()
->class('autocomplete');
$slides->addHidden('link_type')
->getControlPrototype()
->class('link_type');
$slides->addHidden('link_id')
->getControlPrototype()
->class('link_id');
$slides->addUpload('android', 'Android:');
$slides->addUpload('iphone4', 'iPhone4:');
$slides->addUpload('iphone5', 'iPhone5:');
$slides->addUpload('ipad', 'iPad:');
$slides->addCheckBox('active', 'Active')
->getControlPrototype()
->class('active');;
$keys = array('android', 'iphone4', 'iphone5', 'ipad');
foreach($keys as $i){
foreach($keys as $k){
if($i!=$k)
$slides[$i]
->addConditionOn($slides[$k], Form::FILLED)
->addRule(Form::REQUIRED, 'Please submit every type of the slide image.');
}
}
});
$form->setDefaults($this->data);
$form->addSubmit('submit', 'Save');
$form->onValidate[] = $this->sliderValidate;
$form->onSuccess[] = $this->sliderSucceeded;
return $form;
}
public function sliderValidate($form){
if(!empty($form->values->activeFrom) && strtotime($form->values->activeFrom) < 1)
$form->addError('Invalid date for active from field.');
if(count($form->values->slides) < \App\Model\Slider::MIN_SLIDES)
$form->addError('You need to have at least '.\App\Model\Slider::MIN_SLIDES.' slides.');
}
public function sliderSucceeded($form){
if(empty($this->data->id)){
if($id = $this->sliderM->add($form->values)){
$this->flashMessage('Slider set has been successfully saved.', 'success');
$this->redirect('Slider:slides');
}
}else{
if($id = $this->sliderM->edit($this->data->id, $form->values)){
$this->flashMessage('Slider set has been successfully updated.', 'success');
$this->redirect('Slider:slides'/* , array('grid-perPage' => $form->values->perpage, 'grid-paginator-page' => $form->values->page) */);
}
}
}
- David Matějka
- Moderator | 6445
defaultne je v php povoleno max 20 souboru pro request
http://www.php.net/…ini.core.php