Hey,

I followed the sf 1.2 admin gen tutorial. Then I added a file field to
my author table and regenerated everything.
Then in authorform.class.php, I added  $this->widgetSchema['file'] =
new sfWidgetFormInputFile();

When I want to create a new author and attach a file, I get :

This form is multipart, which means you need to supply a files array
as the bind() method second argument.
stack trace

    * at ()
      in SF_SYMFONY_LIB_DIR\form\sfForm.class.php line 225 ...
             222.     {
             223.       if ($this->isMultipart())
             224.       {
             225.         throw new InvalidArgumentException('This
form is multipart, which means you need to supply a files array as the
bind() method second argument.');
             226.       }
             227.
             228.       $this->taintedFiles = array();
    * at sfForm->bind(array('id' => '', 'name' => 'tttttttttt',
'about' => 'ttttttttttttt'))
      in SF_ROOT_DIR\cache\backend\dev\modules\autoAuthors\actions
\actions.class.php line 183 ...
             180.
             181.   protected function processForm(sfWebRequest
$request, sfForm $form)
             182.   {
             183.     $form->bind($request->getParameter('author'));
             184.     if ($form->isValid())
             185.     {
             186.       $this->getUser()->setFlash('notice', $form-
>getObject()->isNew() ? 'The item was created successfully.' : 'The
item was updated successfully.');
    * at autoAuthorsActions->processForm(object('sfWebRequest'), object
('AuthorForm'))
      in SF_ROOT_DIR\cache\backend\dev\modules\autoAuthors\actions
\actions.class.php line 84 ...
              81.     $this->form = $this->configuration->getForm();
              82.     $this->author = $this->form->getObject();
              83.
              84.     $this->processForm($request, $this->form);
              85.
              86.     $this->setTemplate('new');
              87.   }
    * at autoAuthorsActions->executeCreate(object('sfWebRequest'))
      in SF_SYMFONY_LIB_DIR\action\sfActions.class.php line 53 ...
              50.     }
              51.
              52.     // run action
              53.     return $this->$actionToRun($request);
              54.   }
              55. }
  56.
    * at sfActions->execute(object('sfWebRequest'))
      in SF_SYMFONY_LIB_DIR\plugins\sfCompat10Plugin\lib\filter
\sfValidationExecutionFilter.class.php line 167 ...
             164.   {
             165.     // execute the action
             166.     $actionInstance->preExecute();
             167.     $viewName = $actionInstance->execute($this-
>context->getRequest());
             168.     $actionInstance->postExecute();
             169.
             170.     return $viewName ? $viewName : sfView::SUCCESS;
    * at sfValidationExecutionFilter->executeAction(object
('authorsActions'))
      in SF_SYMFONY_LIB_DIR\plugins\sfCompat10Plugin\lib\filter
\sfValidationExecutionFilter.class.php line 85 ...
              82.       return sfView::SUCCESS;
              83.     }
              84.
              85.     return $this->validateAction($filterChain,
$actionInstance) ? $this->executeAction($actionInstance) : $this-
>handleErrorAction($actionInstance);
              86.   }
              87.
              88.   /**
    * at sfValidationExecutionFilter->handleAction(object
('sfFilterChain'), object('authorsActions'))
      in SF_SYMFONY_LIB_DIR\plugins\sfCompat10Plugin\lib\filter
\sfValidationExecutionFilter.class.php line 43 ...
              40.       $timer = sfTimerManager::getTimer(sprintf
('Action "%s/%s"', $actionInstance->getModuleName(), $actionInstance-
>getActionName()));
              41.     }
              42.
              43.     $viewName = $this->handleAction($filterChain,
$actionInstance);
              44.
              45.     if (sfConfig::get('sf_debug') && sfConfig::get
('sf_logging_enabled'))
              46.     {
    * at sfValidationExecutionFilter->execute(object('sfFilterChain'))
      in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 53 ...
              50.       }
              51.
              52.       // execute the next filter
              53.       $this->chain[$this->index]->execute($this);
              54.     }
              55.   }
  56.
    * at sfFilterChain->execute()
      in SF_SYMFONY_LIB_DIR\filter\sfCommonFilter.class.php line
29 ...
              26.   public function execute($filterChain)
              27.   {
              28.     // execute next filter
              29.     $filterChain->execute();
              30.
              31.     // execute this filter only once
              32.     $response = $this->context->getResponse();
    * at sfCommonFilter->execute(object('sfFilterChain'))
      in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 53 ...
              50.       }
              51.
              52.       // execute the next filter
              53.       $this->chain[$this->index]->execute($this);
              54.     }
              55.   }
  56.
    * at sfFilterChain->execute()
      in SF_SYMFONY_LIB_DIR\filter\sfRenderingFilter.class.php line
33 ...
              30.   public function execute($filterChain)
              31.   {
              32.     // execute next filter
              33.     $filterChain->execute();
              34.
              35.     // get response object
              36.     $response = $this->context->getResponse();
    * at sfRenderingFilter->execute(object('sfFilterChain'))
      in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 53 ...
              50.       }
              51.
              52.       // execute the next filter
              53.       $this->chain[$this->index]->execute($this);
              54.     }
              55.   }
  56.
    * at sfFilterChain->execute()
      in SF_SYMFONY_LIB_DIR\controller\sfController.class.php line
245 ...
             242.       }
             243.
             244.       // process the filter chain
             245.       $filterChain->execute();
             246.     }
             247.     else
             248.     {
    * at sfController->forward('authors', 'create')
      in SF_SYMFONY_LIB_DIR\controller\sfFrontWebController.class.php
line 48 ...
              45.       }
              46.
              47.       // make the first request
              48.       $this->forward($moduleName, $actionName);
              49.     }
              50.     catch (sfException $e)
              51.     {
    * at sfFrontWebController->dispatch()
      in SF_SYMFONY_LIB_DIR\util\sfContext.class.php line 159 ...
             156.    */
             157.   public function dispatch()
             158.   {
             159.     $this->getController()->dispatch();
             160.   }
             161.
             162.   /**
    * at sfContext->dispatch()
      in SF_ROOT_DIR\web\backend_dev.php line 13 ...
              10. require_once(dirname(__FILE__).'/../config/
ProjectConfiguration.class.php');
              11.
              12. $configuration =
ProjectConfiguration::getApplicationConfiguration('backend', 'dev',
true);
              13. sfContext::createInstance($configuration)->dispatch
();
14.

symfony settings ...

app_accepted_languages:
  - ru
mod_authors_enabled: true
mod_authors_is_internal: false
mod_authors_view_class: sfPHP
sf_.actions: null
sf_admin_module_web_dir: /sfDoctrinePlugin
sf_admin_web_dir: /sf/sf_admin
sf_app: backend
sf_app_base_cache_dir: 'C:\xampp\htdocs\pmecity\cache\backend'
sf_app_cache_dir: 'C:\xampp\htdocs\pmecity\cache\backend\dev'
sf_app_config_dir: 'C:\xampp\htdocs\pmecity\apps\backend\config'
sf_app_dir: 'C:\xampp\htdocs\pmecity\apps\backend'
sf_app_i18n_dir: 'C:\xampp\htdocs\pmecity\apps\backend\i18n'
sf_app_lib_dir: 'C:\xampp\htdocs\pmecity\apps\backend\lib'
sf_app_module_dir: 'C:\xampp\htdocs\pmecity\apps\backend\modules'
sf_app_template_dir: 'C:\xampp\htdocs\pmecity\apps\backend\templates'
sf_apps_dir: 'C:\xampp\htdocs\pmecity\apps'
sf_cache: false
sf_cache_dir: 'C:\xampp\htdocs\pmecity\cache'
sf_calendar_web_dir: /sf/calendar
sf_charset: utf-8
sf_check_lock: false
sf_check_symfony_version: false
sf_compat_10: true
sf_compressed: false
sf_config_cache_dir: 'C:\xampp\htdocs\pmecity\cache\backend\dev
\config'
sf_config_dir: 'C:\xampp\htdocs\pmecity\config'
sf_csrf_secret: false
sf_data_dir: 'C:\xampp\htdocs\pmecity\data'
sf_debug: true
sf_default_culture: en
sf_doc_dir: 'C:\xampp\htdocs\pmecity\doc'
sf_enabled_modules:
  - default
sf_environment: dev
sf_error_reporting: 8191
sf_escaping_method: ESC_SPECIALCHARS
sf_escaping_strategy: false
sf_etag: false
sf_execution_filter:
  - sfValidationExecutionFilter
  - {  }
sf_i18n: true
sf_i18n_cache_dir: 'C:\xampp\htdocs\pmecity\cache\backend\dev\i18n'
sf_lib_dir: 'C:\xampp\htdocs\pmecity\lib'
sf_log_dir: 'C:\xampp\htdocs\pmecity\log'
sf_logging_enabled: true
sf_max_forwards: 5
sf_module_cache_dir: 'C:\xampp\htdocs\pmecity\cache\backend\dev
\modules'
sf_no_script_name: false
sf_orm: doctrine
sf_plugins_dir: 'C:\xampp\htdocs\pmecity\plugins'
sf_prototype_web_dir: /sfProtoculousPlugin
sf_rich_text_js_dir: js/tiny_mce
sf_root_dir: 'C:\xampp\htdocs\pmecity'
sf_standard_helpers:
  - Partial
  - Cache
  - Form
  - I18N
sf_strip_comments: true
sf_symfony_lib_dir: 'C:\xampp\php\PEAR\symfony'
sf_template_cache_dir: 'C:\xampp\htdocs\pmecity\cache\backend\dev
\template'
sf_test_cache_dir: 'C:\xampp\htdocs\pmecity\cache\backend\dev\test'
sf_test_dir: 'C:\xampp\htdocs\pmecity\test'
sf_upload_dir: 'C:\xampp\htdocs\pmecity\web\uploads'
sf_use_database: true
sf_validation_error_class: form_error
sf_validation_error_id_prefix: error_for_
sf_validation_error_prefix: ' ↓ '
sf_validation_error_suffix: '  ↓'
sf_web_debug: true
sf_web_debug_web_dir: /sf/sf_web_debug
sf_web_dir: 'C:\xampp\htdocs\pmecity\web'

So, I set the needs_multipart option to false to get it works.

But how do you use it with multipart, what for and how do you get the
databack. In my database, it saves the name of the file but it do not
save the path of the file and it does not save the file in any kind of
folder.

I would like to be able to upload the photo and then show it in my
list view.

Thanks for help.

Regards,

Frédéric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to