[web-devel] Yesod, picture uploading, storing, rendering

Michael Snoyman michael at snoyman.com
Wed Jun 22 19:26:24 CEST 2011


In general, the recommended approach is to store binary files on the
filesystem instead of in the database. In the Yesod wiki, I violate
that :(. It's significantly more complicated than what you're looking
for, since it's parsing an entire ZIP file and pulling out
DITA-formatted XML, but you can look at the relevant file:
https://github.com/snoyberg/yesodwiki/blob/master/Handler/UploadDitamap.hs

Note that I currently base64-encode the content since HDBC-postgresql
has problems with binary data. I'm hoping that gets resolved (or that
we move over to Chris's new PostgreSQL library).

Michael

On Wed, Jun 22, 2011 at 7:34 PM, Anton Cheshkov <acheshkov at gmail.com> wrote:
> Hi Michael,
> please tell about the best way you see to upload  store  and render pictures
> in the Yesod application.
> How is better to store the pictures either file system or  DB.
> It would be great to see the code example shows how to upload store and
> render just uploaded pictures with Yesod.
> I think you have something like this already.
>
> Thanks.
>
> --
> Best regards,
> Cheshkov Anton
>
>



More information about the web-devel mailing list