Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Doctrine File upload trouble
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mlmarius  
View profile  
 More options Jun 7, 1:04 pm
From: mlmarius <mlmar...@gmail.com>
Date: Sun, 7 Jun 2009 10:04:59 -0700 (PDT)
Local: Sun, Jun 7 2009 1:04 pm
Subject: Doctrine File upload trouble
Hello, i am trying to build a file upload with sf 1.2 and doctrine. I
am following this tutorial :
http://www.symfony-project.org/forms/1_2/en/11-Doctrine-Integration#c...
( look for "file upload" ).

I have the following schema ( only 1 model ) :

StoredFile:
  columns:
    file:         string(255)
    name:         string(25

i build everything and then i modify the form class like so :

class StoredFileForm extends BaseStoredFileForm
{
  public function configure()
  {
    $this->widgetSchema['file'] = new sfWidgetFormInputFile();
    $this->validatorSchema['file'] = new sfValidatorFile();
  }

}

i then build a module which allso contains the show action and modify
the generated "processForm" method of the module like so :

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()),$request-

>getFiles($form->getName()));

    if ($form->isValid())
    {

      $file = $this->form->getValue('file');
      $filename = sha1($file->getOriginalName()).$file->getExtension
($file->getOriginalExtension());
      $file->save(sfConfig::get('sf_upload_dir').'/'.$filename);

      $stored_file = $form->save();

      $this->redirect('upload/show?id='.$stored_file->getId());
    }
  }

The problem :

After i upload my file and fill out the name i get this error :

--------------------------------------------------------------------------- -------
500 | Internal Server Error | Doctrine_Validator_Exception
Validation failed in class StoredFile

1 field had validation error:

* 1 validator failed on file (type)
--------------------------------------------------------------------------- --------

... and i don't know what to make of it. Any help ?

P.S. i can allso provide the stack trace if necessary.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gábor Fási  
View profile  
 More options Jun 7, 1:32 pm
From: Gábor Fási <maerl...@gmail.com>
Date: Sun, 7 Jun 2009 19:32:37 +0200
Local: Sun, Jun 7 2009 1:32 pm
Subject: Re: [symfony-users] Doctrine File upload trouble
Try providing the accepted mime types.
http://www.symfony-project.org/forms/1_2/en/B-Validators#chapter_b_su...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mlmarius  
View profile  
 More options Jun 7, 1:44 pm
From: mlmarius <mlmar...@gmail.com>
Date: Sun, 7 Jun 2009 10:44:44 -0700 (PDT)
Local: Sun, Jun 7 2009 1:44 pm
Subject: Re: Doctrine File upload trouble
I first provided an array of mime types and after that i tried with
the mime category but still nothing, same error .

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thomas Rabaix  
View profile  
 More options Jun 8, 3:43 am
From: Thomas Rabaix <thomas.rab...@gmail.com>
Date: Mon, 8 Jun 2009 09:43:15 +0200
Local: Mon, Jun 8 2009 3:43 am
Subject: Re: [symfony-users] Re: Doctrine File upload trouble

The error comes from Doctrine Validation feature. You have to set the 'type'
field, or disable the feature ....

On Sun, Jun 7, 2009 at 7:44 PM, mlmarius <mlmar...@gmail.com> wrote:

> I first provided an array of mime types and after that i tried with
> the mime category but still nothing, same error .

--
Thomas Rabaix
http://rabaix.net

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mlmarius  
View profile  
 More options Jun 8, 3:48 am
From: mlmarius <mlmar...@gmail.com>
Date: Mon, 8 Jun 2009 00:48:14 -0700 (PDT)
Local: Mon, Jun 8 2009 3:48 am
Subject: Re: Doctrine File upload trouble
If you are refering to the mime types , as i've said above , i did set
the mime types. If not please be more specific ... to which "type" are
you referring ?

On 8 Iun, 10:43, Thomas Rabaix <thomas.rab...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johannes Heinen  
View profile  
 More options Jun 8, 5:45 am
From: Johannes Heinen <johannes.hei...@googlemail.com>
Date: Mon, 8 Jun 2009 02:45:05 -0700 (PDT)
Local: Mon, Jun 8 2009 5:45 am
Subject: Re: Doctrine File upload trouble
It is probably not the best solution for your problem, but if you'd
use sfFilebasePlugin which supports a few doctrine based asset
management capabilities added to various file handling stuff based on
SPL, you could help me to improve the plugin and provide a stable
assets manager for sf 1.2 + doctrine not depending on compat1.0 stuff.

Please don't feel annoyed by this "commercial" for "my" plugin, it is
only that i spent a lot of time into this stuff in my free time, but
because of the beta state and user counter (the one user of the plugin
out there is me :D) i'd love to get some feedback from other users or
perhaps even improvements.

If you decide to take alook on it, use the pre packaged pear stuff,
the svn trunk is in devel state and not yet ready to use (i actually
work on a multi file upload widget).

Greetings
Joshi

On 8 Jun., 09:48, mlmarius <mlmar...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mlmarius  
View profile  
 More options Jun 8, 6:02 am
From: mlmarius <mlmar...@gmail.com>
Date: Mon, 8 Jun 2009 03:02:58 -0700 (PDT)
Local: Mon, Jun 8 2009 6:02 am
Subject: Re: Doctrine File upload trouble
No worries mate ... it's good to hear about the plugin you are working
on ... and i may give it a shot some time but i first need to figure
out what's wrong with my code. Thanks .

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mlmarius  
View profile  
 More options Jun 8, 12:53 pm
From: mlmarius <mlmar...@gmail.com>
Date: Mon, 8 Jun 2009 09:53:18 -0700 (PDT)
Local: Mon, Jun 8 2009 12:53 pm
Subject: Re: Doctrine File upload trouble
[SOLVED] For who may encounter this problem : allways set your 'path'
variable inside sfValidatorFile

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google