Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

File storage options

james.telfer's Avatar

james.telfer

03 May, 2011 12:36 AM

When hosting with AH, I seem to have 2 options for persisting user-uploaded content: BLOB or external service (e.g. S3). I need to support users uploading images and documents, and I need to support resizing the images. I'm thinking the most straightforward resize method is to generate the sizes I need on upload and distribute it then to the storage container.

Does anyone have a recommendation for working with uploaded content on AH?

  1. Support Staff 1 Posted by friism on 03 May, 2011 04:35 AM

    friism's Avatar

    If your app need temporary storage, it can use the App_Data folder. If you plan to scale the app you should not rely on two different requests hitting the same instance and having the same App_Data-stored files available.

    Let us know if this doesn't answer you question.

  2. friism closed this discussion on 03 May, 2011 04:35 AM.

  3. james.telfer re-opened this discussion on 03 May, 2011 04:39 AM

  4. 2 Posted by james.telfer on 03 May, 2011 04:39 AM

    james.telfer's Avatar

    That is correct; my question is more regarding good practice for avoiding using the App_Data folder.

    For small hosted projects it is possible to store the data that users upload locally and expect it to stay there. On AH, however, it is necessary to make sure that the application doesn't rely on the file system.

    So, with the restrictions of AH in mind, I'm trying to get an idea of other's experience and how they managed it.

  5. Support Staff 3 Posted by rune on 03 May, 2011 06:10 AM

    rune's Avatar

    Hi James,

    One of our users wrote this blog post on how to store a file to S3 http://bradoyler.com/post/3614362044/uploading-an-image-with-aws-sd... . This may be the best approach for you if you'd also like to manipulate the image before saving it to S3.

    You can also have a look at this discussion http://support.appharbor.com/discussions/problems/292-upload-sizes for more inspiration.

    It should also be possible to upload files directly to S3 using javascript on the client side, which makes it more efficient by avoiding the AppHarbor roundtrip.

    If you figure out a good solution it would be great if you could share it so other people will benefit from it.

    Best,
    Rune

  6. 4 Posted by leedumond on 06 May, 2011 04:14 AM

    leedumond's Avatar

    This may be a silly question on my part, but why not store images as varbinary in the database? Isn't that also an option?

  7. Support Staff 5 Posted by friism on 06 May, 2011 05:34 AM

    friism's Avatar

    While using the database for file-storage is a servicable option, it's not recommended for performance reasons. We strongly encourage you to use S3 for filestorage.

  8. friism closed this discussion on 06 May, 2011 05:34 AM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac