sfWidgetFormInputSWFUpload doesn't work

Ask help about existing plugins, or find advice about the way to build up your own.

Moderators: dwhittle, Ian

sfWidgetFormInputSWFUpload doesn't work

Postby SmallBen » Thu Jul 29, 2010 2:20 pm

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? :oops:

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>
SmallBen
Member
 
Posts: 38
Joined: Wed Sep 30, 2009 10:20 am

Re: sfWidgetFormInputSWFUpload doesn't work

Postby SmallBen » Fri Jul 30, 2010 9:38 am

WebDeveloper shows an error "SWFUpload is not defined". How can i fix it?
SmallBen
Member
 
Posts: 38
Joined: Wed Sep 30, 2009 10:20 am

Re: sfWidgetFormInputSWFUpload doesn't work

Postby SmallBen » Fri Jul 30, 2010 10:13 am

OK little step forward - the plugin shows the browse, start, cancel link's :D~ :-D~ :grin: 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??
Last edited by SmallBen on Fri Jul 30, 2010 12:15 pm, edited 1 time in total.
SmallBen
Member
 
Posts: 38
Joined: Wed Sep 30, 2009 10:20 am

Re: sfWidgetFormInputSWFUpload doesn't work

Postby SmallBen » Fri Jul 30, 2010 1:51 pm

OK i've made it, that was as simple as put
Code: Select all
<? php include_stylesheets()?>
into layout.php:d
SmallBen
Member
 
Posts: 38
Joined: Wed Sep 30, 2009 10:20 am

Re: sfWidgetFormInputSWFUpload doesn't work

Postby jostster » Wed Aug 04, 2010 2:02 am

How did you get the browse and cancel links to show up? I too am having trouble as i just see a simple choose file button.
jostster
Junior Member
 
Posts: 7
Joined: Thu May 13, 2010 8:13 pm

Re: sfWidgetFormInputSWFUpload doesn't work

Postby SmallBen » Wed Aug 04, 2010 4:57 pm

In my case all plugin's files were in plugins/sfWidgetFormInputSWFUploadPlugin directory and i couldn't get right URL to them.

This is what i did, first I have copyied:
1. /plugins/sfWidgetFormInputSWFUploadPlugin/web/css/swfupload.css file to /web/css/swfupload.css
2. all files from /plugins/sfWidgetFormInputSWFUploadPlugin/web/images/*.* to /web/images/swfupload_plugin/*.*
3. vendor directory and swfupload-widget-handler.js file from /plugins/sfWidgetFormInputSWFUploadPlugin/web/js/ to /web/js/swfupload_plugin/

and then configure the wideget like this:

Code: Select all
[i]/lib/form/PictureForm.class.php[/i]

$this->widgetSchema['zdjecie'] = new sfWidgetFormInputSWFUpload(array(
            'swfupload_flash_url'   =>   public_path('/js/swfupload_plugin/vendor/swfupload/swfupload/swfupload.swf'),
            'swfupload_css_path'   =>   public_path('/css/swfupload.css'),   
            'swfupload_js_path'      =>   public_path('/js/swfupload_plugin/vendor/swfupload/swfupload/swfupload.js'),
            'swfupload_handler_path'=>   public_path('/js/swfupload_plugin/swfupload-widget-handler.js'),
            'swfupload_plugins_dir'   =>   public_path('/js/swfupload_plugin/vendor/swfupload/plugins'),
            'swfupload_upload_url'   =>   url_for("/backend_dev.php/pictures/dodaj")."?z=".session_id(),
            'collapse_queue_on_init'=>   false,
            'send_serialized_values'=>   true
      ));


(You've got to be sure that the files pointed by the URL's exists. And ofcourse you've got to set your 'swfupload_upload_url')

Besides I forgot to include javascripts and stylesheets in /apps/backend/templates/layout.php
SmallBen
Member
 
Posts: 38
Joined: Wed Sep 30, 2009 10:20 am

Re: sfWidgetFormInputSWFUpload doesn't work

Postby wam_baloo » Fri Oct 01, 2010 2:36 pm

Hi !!!

I'm trying to use this plugin, but it doesn't work. I'm trying it under three web browsers : ie8, ff3 and google chrome.

Here is the code for my form class :
Code: Select all
class FamilyForm extends BaseFamilyForm
{
  public function configure()
  {
     $this->widgetSchema['img'] = new sfWidgetFormInputSWFUpload(array(
       'swfupload_upload_url' => url_for("/backend_dev.php/family/upload"),
      'collapse_queue_on_init'=>   false,
    ));
   
     $this->validatorSchema['img'] = new sfValidatorFile(array(
     'required'   => true,
     'path'       => sfConfig::get('sf_upload_dir'),
     'mime_types' => 'web_images',
   ));
   
   $this->widgetSchema->setLabels(array(
        'name'       => 'Nom',
        'img'       => 'Image'
   ));
  }
}


I see the flash box on google chrome and on ie but when I click on the links, nothing happens.
On Firefox, I don't see the box, I only the classic input file field, and I have no error on firebug.

I think I can do what I want with this plugin, I mean, I want, in a form, upload an image, and render it with ajax reload.

Maybe I'm wrong with this plugin, or maybe this plugin is not for what I want to do.

Any help would be appreciated :)

Thanks !
wam_baloo
Member
 
Posts: 56
Joined: Thu Jun 01, 2006 12:18 pm

Re: sfWidgetFormInputSWFUpload doesn't work

Postby marek » Wed Oct 20, 2010 4:16 am

Hi!
I've installed it with pear and done everything according to instructions on http://www.symfony-project.org/plugins/sfWidgetFormInputSWFUploadPlugin
Haven't checked if it's actually works but tried so far in different browsers and found out that it works well in FF and Opera. In Chrome it takes about 5 seconds to replace classic input form with the one from plugin. In IE8 classic input form isn't replaced at all.
Any way to speed it up in chrome and why it doesn't work in IE8?
Thanks!
marek
Junior Member
 
Posts: 2
Joined: Wed Oct 20, 2010 3:28 am

Re: sfWidgetFormInputSWFUpload doesn't work

Postby SmallBen » Thu Oct 21, 2010 9:45 am

For me it works correctly on both browsers (IE8, Chrome)
SmallBen
Member
 
Posts: 38
Joined: Wed Sep 30, 2009 10:20 am

Re: sfWidgetFormInputSWFUpload doesn't work

Postby maggie » Fri Mar 04, 2011 11:49 am

Hi,

for me it doesnt work either. Did you find a solution?

Maggie
maggie
Junior Member
 
Posts: 2
Joined: Fri Mar 04, 2011 11:48 am


Return to General plug-ins

Who is online

Users browsing this forum: No registered users and 1 guest