This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » General plug-ins » sfWidgetFormInputSWFUpload doesn't work
icon4.gif  sfWidgetFormInputSWFUpload doesn't work [message #103238] Thu, 29 July 2010 14:20 Go to previous message
SmallBen  is currently offline SmallBen
Messages: 21
Registered: September 2009
Junior Member
Hi
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? Embarassed

I'am using symfony 1.4.1, here's my code

backend/modules/pictures/actions/actions.class.php
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
<?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
<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>

Read Message
Read Message
Read Message
Read Message
Previous Topic:sfWidgetFormInputSWFUploadPlugin problem
Next Topic:sfWidgetFormInputSWFUpload in backend application
Goto Forum:

  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software