Isn't it an escaping problem ?

Update a simple text file with "Hello <strong>World</strong>". Use it for
your tests and look at generated file & headers (and tell us :).

Alexandre

2009/10/16 David Régade <[email protected]>

>
> Hi,
>
> I use symfony with doctrine and I try to store some binary data in my
> MySQL database. So I defined a class with a blob field like this:
>
> File:
>  columns:
>    id:
>      type: integer
>      primary: true
>      unsigned: true
>      notnull: true
>      autoincrement: true
>    name:
>      type: string(255)
>    size:
>      type: integer
>      unsigned: true
>      notnull: true
>    mime_type:
>      type: string(255)
>    binary_data:
>      type: blob
>
> I generate a module for this class. But unfortunatelly I can't access
> binary_data field in templates. binary_data field is ok in actions but
> never in templates.
> I try to create an action to download a file. Here is my action:
>
> public function executeGetFile(sfWebRequest $request) {
>    $this->forward404Unless( $this->file = Doctrine::getTable('File')-
> >find(array($file_id)), sprintf('Object file does not exist (%s).',
> array( $file_id )) );
>
>    $this->getResponse()->setHttpHeader('Content-Type', $this->file-
> >mime_type, true);
>    $this->getResponse()->setHttpHeader('Content-Disposition',
> 'attachment; filename="'.$this->file->name.'"', true);
>
>     //file_put_contents("/tmp/titi.pdf", $this->file->binary_data);
> }
>
> Here is my template:
> <?php echo $file->binary_data;
>
>
> No data is echoed, Is there a reason for that ?
>
> Regards
>
> >
>


-- 
Alexandre Salomé -- [email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
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