Yesod, picture uploading, storing, rendering

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

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
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

Hello Michael,
i have started to deal with file uploading and found several problems
1. The Yesod restricts file upload for non-small files http response
is *Status: 413
Request Entity Too Large. *
* *How can change this ?
2. Yesod does not recognize file uploding via XHR. The *runRequestBody
*function
returns the empty files list.
How to see the uploading file content ?
Thanks.
2011/6/22 Michael Snoyman
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
Hi Michael, please tell about the best way you see to upload store and render
On Wed, Jun 22, 2011 at 7:34 PM, Anton Cheshkov
wrote: 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
-- Best regards, Cheshkov Anton Phone: +7 909 005 18 82 Skype: cheshkov_anton

On Sun, Jun 26, 2011 at 1:40 PM, Anton Cheshkov
Hello Michael, i have started to deal with file uploading and found several problems 1. The Yesod restricts file upload for non-small files http response is Status: 413 Request Entity Too Large. How can change this ?
http://hackage.haskell.org/packages/archive/yesod-core/0.8.2/doc/html/Yesod-...
2. Yesod does not recognize file uploding via XHR. The runRequestBody function returns the empty files list. How to see the uploading file content ?
You likely need to change the content-type request header to reflect multipart-form data. Michael
participants (2)
-
Anton Cheshkov
-
Michael Snoyman