[2.0] How Use File after uploaded it ?

401 views
Skip to first unread message

jhon dho

unread,
Dec 13, 2012, 10:33:14 AM12/13/12
to play-fr...@googlegroups.com
Hi everybody,

i did not find my hapiness in all questions....

Today, i know how to upload files on my site but i do not know how to use it after it is uploaded. 
When The file is uploaded i copy it in "public/images" folder. But when i go to http://www.mysite.com/assets/images/file.txt , the url is not found and i have to restart my site.

Do you know a method which will give me the possibility to use the uploaded file?

Thanks for you help!

James Roper

unread,
Dec 13, 2012, 9:26:05 PM12/13/12
to play-fr...@googlegroups.com
Play doesn't make it easy for you to do this because it's not a very good way to do things, it is unreliable, it doesn't scale, and there are security concerns.  You should store the file in a database or on an external hosting provider like S3.

If you really want, you can write your own assets controller that can serve files that you've uploaded from the file system.

jhon dho

unread,
Dec 15, 2012, 3:11:58 AM12/15/12
to play-fr...@googlegroups.com
Thank you for you answer.

If I want store it in data base, i have to use , blob type?

And what i have to do in order to display the image (in bacground for example)?

Thank for you help again!!

ultimatereal

unread,
Feb 21, 2013, 5:52:53 PM2/21/13
to play-fr...@googlegroups.com

If interested in an implementation of a custom-made controller for this purpose, there is some code here that does as such - http://stackoverflow.com/questions/15006542/play-2-1-cant-access-uploaded-image-until-server-restarted

jhon dho

unread,
Feb 24, 2013, 2:51:46 PM2/24/13
to play-fr...@googlegroups.com
Thank you , it's exactally that i want!
Reply all
Reply to author
Forward
0 new messages