I'm trying to upload multiple files. I've found this plugin, install it and all i've got is normal upload button in which i can select one file and nothing happens. Does this plugin work on localhost? What am I doing wrong?
I'am using symfony 1.4.1, here's my code
backend/modules/pictures/actions/actions.class.php
- Code: Select all
class picturesActions extends autoPicturesActions
{
public function executeDodaj(sfWebRequest $request)
{
$this->form = new PictureForm();
if($request->isMethod('post'))
{
$this->form->bind($request->getParameter('screen'), $request->getFiles('screen'));
$values = $this->form->getValues();
$file = $values['zdjecie'];
if($file)
{
$filecount = count(glob(sfConfig::get('sf_web_dir').'/uploads/images/*.*'));
$filename = 'zdjecie'. ++$filecount;
$extension = $file->getExtension();
if($file->save(sfConfig::get('sf_web_dir') . '/uploads/images/'. $filename . $extension))
{
}
else
{
echo "UPLOAD FAILED";
}
}
else
{
echo "NO FILE SELECTED";
}
$this->setLayout(false);
$this->getResponse()->setContent('OK');
return sfView::NONE;
}
}
}
lib/form/PictureForm.class.php
- Code: Select all
<?php
class PictureForm extends sfForm
{
public function configure()
{
$this->setWidgets(array(
'zdjecie' => new sfWidgetFormInputSWFUpload()
));
$this->widgetSchema['zdjecie']->setOption('collapse_queue_on_init', false);
$this->widgetSchema->setNameFormat('screen[%s]');
$this->setValidators(array(
'zdjecie' => new sfValidatorFile(array(
'required' => true,
'path' => sfConfig::get('sf_upload_dir').'/images',
'mime_types'=>'web_images',
))
));
}
}
?>
apps/backend/modules/pictures/templates/dodajSuccess.php
- Code: Select all
<form action="<?php echo url_for('@pics')?>" method="POST" enctype="multipart/form-data" accept-charset="utf-8">
<p>
<?php use_stylesheets_for_form($form)?>
<?php use_javascripts_for_form($form)?>
<?php echo $form?>
</p>
</form>
