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 in backend application
sfWidgetFormInputSWFUpload in backend application [message #103347] Sat, 31 July 2010 13:08 Go to next message
SmallBen  is currently offline SmallBen
Messages: 21
Registered: September 2009
Junior Member
HI
I'am trying to use this plugin in my backend application, the widget works fine, but when i try to upload files, progress bar goes to 100% and small login site with csrf token:Required message appear above it, like in this picture
http://cmsmania.pl/csrf.jpg

Of course the image is not uploaded. How can i make it work?

here's my code:

apps/backend/modules/pictures/actions/actions.class.php
public function executeDodaj(sfWebRequest $request)
	{
		$this->form = new PictureForm();
		if($request->isMethod('post'))
		{
			echo var_export($_FILES);

		  // UNSET THE RESPONSE
		  $this->setLayout(false);
		  return sfView::NONE;
		}
        }


apps/backend/modules/pictures/dodajSuccess.php
<form 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?>
        <input type="hidden" name="sf_method" value="post" />
		<input type="submit" />
      </p>
</form>


lib/form/PictureForm.class.php
class PictureForm extends sfForm
  {
		 public function configure()
    {
		$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'),
				'collapse_queue_on_init'=>	false,
				'send_serialized_values'=>	true
		));
		$this->widgetSchema->setNameFormat('screen[%s]');
		
        $this->setValidators(array(
			'zdjecie' => new sfValidatorFile()
        ));
    }
  }


When i turn off the JavaScript and try to upload picture by clicking on the submit button (without using plugin) everything is OK (export_var shows me the $_FILES array)

[Updated on: Sat, 31 July 2010 13:21]

Re: sfWidgetFormInputSWFUpload in backend application [message #103351 is a reply to message #103347 ] Sat, 31 July 2010 15:03 Go to previous message
SmallBen  is currently offline SmallBen
Messages: 21
Registered: September 2009
Junior Member
When i change the 'post' method into the 'put' (just like in plugins README file) it returns 401 Unauthorized error

http://www.cmsmania.pl/unauthorized.jpg

So i think that the sfGuard plugin doesn't accept this js generated forms.

Does anybody use this plugin inside backend application which require the user to be authenticated???

Previous Topic:sfWidgetFormInputSWFUpload doesn't work
Next Topic:prestaForumConnector and DoctrineApplyPLugin
Goto Forum:
  

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