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 next 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>
Re: sfWidgetFormInputSWFUpload doesn't work [message #103272 is a reply to message #103238 ] Fri, 30 July 2010 09:38 Go to previous messageGo to next message
SmallBen  is currently offline SmallBen
Messages: 21
Registered: September 2009
Junior Member
WebDeveloper shows an error "SWFUpload is not defined". How can i fix it?
Re: sfWidgetFormInputSWFUpload doesn't work [message #103274 is a reply to message #103238 ] Fri, 30 July 2010 10:13 Go to previous messageGo to next message
SmallBen  is currently offline SmallBen
Messages: 21
Registered: September 2009
Junior Member
OK little step forward - the plugin shows the browse, start, cancel link's Very Happy but when i click on browse link nothing happens Sad
I think there shoud be a browse button(not tekstlink), because i found a browse.png file in image directory and when i set widget 'swfupload_button_image_url' option to point at this file(i didn't know what is this option so i play with it), a part of this image shows up under uploading progress bar. The best thing is that when i click on this image a file browse window appears!!!

So i think there is a problem with generate correct browse link. Where can i set the url to images from this plugin because none of these images are displayed on the screen.

Any ideas how to solve this problem??

[Updated on: Fri, 30 July 2010 12:15]

icon6.gif  Re: sfWidgetFormInputSWFUpload doesn't work [message #103296 is a reply to message #103238 ] Fri, 30 July 2010 13:51 Go to previous message
SmallBen  is currently offline SmallBen
Messages: 21
Registered: September 2009
Junior Member
OK i've made it, that was as simple as put
<? php include_stylesheets()?>
into layout.php:d
Previous Topic:sfWidgetFormInputSWFUploadPlugin problem
Next Topic:sfWidgetFormInputSWFUpload in backend application
Goto Forum:
  

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