0

So I'm trying to figure out how I can configure a filesystem with Play Framework 2.0 to store blob type files, while using a database to store it's directory/path to reference.

Having some trouble doing this, but I've found a link that shows you how to configure it as a main alternative, but it is in place of a database.

I'm trying to use the database to store the reference path in the file system so that I could reference that back to the actual location of the blob file or image stored. Has anyone done this before? If so, help or guidance would be greatly appreciated!

Here is the link: How to configure FS database in playframework 2.0?

(editor's note: this link is useless for this question, as it's describes configuring H2 storage configuration)

Thanks in advance!

Community
  • 1
  • 1
entrevu
  • 3
  • 3

1 Answers1

0

You messed up things a little, the link you provided instructs how to configure whole H2 database to be storred on the disk or just in the memory.

For your purpose you should just adopt File Upload sample from Play's documentation

The additional thing you have to do BEFORE return ok("File uploaded"); line is to find record in your MySQL and update it by adding fileName and/or contentType as a refference to file storred on the disk.

Play for a while with File type, then you'll be able to store files in FS where you'll want and how you'll want

biesior
  • 55,576
  • 10
  • 125
  • 182