Managing user files

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Managing user files

Joshua Kehn
Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Peter Bell-5
Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Joshua Kehn
Peter-

Mapped directory sounds good, can you elaborate on that?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:

Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email][hidden email]
http://joshuakehn.com


Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Erik  Pragt
Hoi Josh,

Take a look at this tutorial, I think it provides a good starting point:


Kind regards,

Erik Pragt

On 6 feb 2011, at 21:57, Joshua Kehn wrote:

Peter-

Mapped directory sounds good, can you elaborate on that?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:

Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email][hidden email]
http://joshuakehn.com



Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Sebastian Hohns
In reply to this post by Joshua Kehn
Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Joshua Kehn
In reply to this post by Erik Pragt
Erik-

While informative that's not exactly what I'm looking for. Essentially I would like to server content from outside of the webapps directory.

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 4:13 PM, Erik Pragt wrote:

Hoi Josh,

Take a look at this tutorial, I think it provides a good starting point:


Kind regards,

Erik Pragt

On 6 feb 2011, at 21:57, Joshua Kehn wrote:

Peter-

Mapped directory sounds good, can you elaborate on that?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:

Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email][hidden email]
http://joshuakehn.com




Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Joshua Kehn
In reply to this post by Sebastian Hohns
Halfway there, but I'm using Tomcat 6, and getting an error that it can't find the directory for some reason.

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 4:16 PM, Sebastian Hohns wrote:


configuration depends on your app server.

tomcat
http://gandhim.wordpress.com/2008/01/31/tomcat-55-virtual-directory/

glassfish
http://www.marceble.com/2009/07/virtual-directories-in-glassfish/


--
View this message in context: http://grails.1312388.n4.nabble.com/Managing-user-files-tp3263170p3263202.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

gauravchauhan
In reply to this post by Joshua Kehn
Sorry i sound novice. But i believe you are trying to store images uploaded by user. You can define the file storage location in Config.groovy and create helper methods to save and get the file.



Regards
Gaurav Chauhan
Mobile: +91-88803-97337



On Mon, Feb 7, 2011 at 2:47 AM, Joshua Kehn <[hidden email]> wrote:
Erik-

While informative that's not exactly what I'm looking for. Essentially I would like to server content from outside of the webapps directory.

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 4:13 PM, Erik Pragt wrote:

Hoi Josh,

Take a look at this tutorial, I think it provides a good starting point:


Kind regards,

Erik Pragt

On 6 feb 2011, at 21:57, Joshua Kehn wrote:

Peter-

Mapped directory sounds good, can you elaborate on that?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:

Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email][hidden email]
http://joshuakehn.com





Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Erik  Pragt
In reply to this post by Joshua Kehn
Hi Josh,

Sorry, totally my bad. I mixed up some tutorials. I meant this one: http://grails.org/Simple+Avatar+Uploader

In that tutorial, the images comes from the user, but you can easily change that (for example, to a location on disk), and read the bytes in from that location. You can do that easily using Commons IO:

File file = new File("/my/custom/location/file.txt")
InputStream is = new FileInputStream(file)
byte[] bytes = IOUtils.toByteArray(is)

Would that help more?

Kind regards, 

Erik Pragt




On 6 feb 2011, at 22:17, Joshua Kehn wrote:

Erik-

While informative that's not exactly what I'm looking for. Essentially I would like to server content from outside of the webapps directory.

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 4:13 PM, Erik Pragt wrote:

Hoi Josh,

Take a look at this tutorial, I think it provides a good starting point:


Kind regards,

Erik Pragt

On 6 feb 2011, at 21:57, Joshua Kehn wrote:

Peter-

Mapped directory sounds good, can you elaborate on that?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:

Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email][hidden email]
http://joshuakehn.com





Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Joshua Kehn
In reply to this post by gauravchauhan
I would like to serve images uploaded by FTP. 

___________________________
http://joshuakehn.com
Sent from my iPod

On Feb 6, 2011, at 6:20 PM, Gaurav Chauhan <[hidden email]> wrote:

Sorry i sound novice. But i believe you are trying to store images uploaded by user. You can define the file storage location in Config.groovy and create helper methods to save and get the file.



Regards
Gaurav Chauhan
Mobile: +91-88803-97337



On Mon, Feb 7, 2011 at 2:47 AM, Joshua Kehn <[hidden email]> wrote:
Erik-

While informative that's not exactly what I'm looking for. Essentially I would like to server content from outside of the webapps directory.

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 4:13 PM, Erik Pragt wrote:

Hoi Josh,

Take a look at this tutorial, I think it provides a good starting point:


Kind regards,

Erik Pragt

On 6 feb 2011, at 21:57, Joshua Kehn wrote:

Peter-

Mapped directory sounds good, can you elaborate on that?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:

Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email][hidden email]
http://joshuakehn.com





Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Joshua Kehn
In reply to this post by Erik Pragt
That looks promising, I'll take a look when I'm less mobile. 

Regards,

-Josh
___________________________
http://joshuakehn.com
Sent from my iPod

On Feb 6, 2011, at 6:48 PM, Erik Pragt <[hidden email]> wrote:

Hi Josh,

Sorry, totally my bad. I mixed up some tutorials. I meant this one: http://grails.org/Simple+Avatar+Uploader

In that tutorial, the images comes from the user, but you can easily change that (for example, to a location on disk), and read the bytes in from that location. You can do that easily using Commons IO:

File file = new File("/my/custom/location/file.txt")
InputStream is = new FileInputStream(file)
byte[] bytes = IOUtils.toByteArray(is)

Would that help more?

Kind regards, 

Erik Pragt




On 6 feb 2011, at 22:17, Joshua Kehn wrote:

Erik-

While informative that's not exactly what I'm looking for. Essentially I would like to server content from outside of the webapps directory.

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 4:13 PM, Erik Pragt wrote:

Hoi Josh,

Take a look at this tutorial, I think it provides a good starting point:


Kind regards,

Erik Pragt

On 6 feb 2011, at 21:57, Joshua Kehn wrote:

Peter-

Mapped directory sounds good, can you elaborate on that?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email]
http://joshuakehn.com

On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:

Put it in database, save it to mapped directory on the server or use S3.

Sent from my iPhone

On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:

Suppose I want a user to be able to upload images and store them. How do I do that in a way it doesn't conflict with deploying a WAR?

Regards,

-Josh
____________________________________
Joshua Kehn | [hidden email][hidden email]
http://joshuakehn.com





Reply | Threaded
Open this post in threaded view
|

Re: Managing user files

Jason Davis
 <Context docBase="/opt/winmail_storage/imgs" path="/imgs"/>

Thats all I added to my server.xml to get external img directory working:


      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
          <Context docBase="/opt/winmail_storage/imgs" path="/imgs"/>
</Host>



On Sun, Feb 6, 2011 at 5:34 PM, Josh Kehn <[hidden email]> wrote:

> That looks promising, I'll take a look when I'm less mobile.
> Regards,
>
> -Josh
> ___________________________
> http://joshuakehn.com
> Sent from my iPod
> On Feb 6, 2011, at 6:48 PM, Erik Pragt <[hidden email]> wrote:
>
> Hi Josh,
> Sorry, totally my bad. I mixed up some tutorials. I meant this
> one: http://grails.org/Simple+Avatar+Uploader
> In that tutorial, the images comes from the user, but you can easily change
> that (for example, to a location on disk), and read the bytes in from that
> location. You can do that easily using Commons IO:
> File file = new File("/my/custom/location/file.txt")
> InputStream is = new FileInputStream(file)
> byte[] bytes = IOUtils.toByteArray(is)
> Would that help more?
> Kind regards,
> Erik Pragt
>
>
>
> On 6 feb 2011, at 22:17, Joshua Kehn wrote:
>
> Erik-
> While informative that's not exactly what I'm looking for. Essentially I
> would like to server content from outside of the webapps directory.
> Regards,
> -Josh
> ____________________________________
> Joshua Kehn | [hidden email]
> http://joshuakehn.com
> On Feb 6, 2011, at 4:13 PM, Erik Pragt wrote:
>
> Hoi Josh,
> Take a look at this tutorial, I think it provides a good starting point:
> http://grails.org/File+Upload
> Kind regards,
> Erik Pragt
> http://www.jworks.nl
> On 6 feb 2011, at 21:57, Joshua Kehn wrote:
>
> Peter-
> Mapped directory sounds good, can you elaborate on that?
> Regards,
> -Josh
> ____________________________________
> Joshua Kehn | [hidden email]
> http://joshuakehn.com
> On Feb 6, 2011, at 3:47 PM, Peter Bell wrote:
>
> Put it in database, save it to mapped directory on the server or use S3.
>
> Sent from my iPhone
> On Feb 6, 2011, at 3:45 PM, Joshua Kehn <[hidden email]> wrote:
>
> Suppose I want a user to be able to upload images and store them. How do I
> do that in a way it doesn't conflict with deploying a WAR?
> Regards,
> -Josh
> ____________________________________
> Joshua Kehn | [hidden email]
> http://joshuakehn.com
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

НА: Re: Managing user files

ishe
Also, you can see "grails burning-image plugin". It stores files to disk too.


--
ishe

----- Исходное сообщение -----
От: Jason Davis [via Grails] <[hidden email]>
Отправлено: 7 февраля 2011 г. 6:06
Кому: ig78 <[hidden email]>
Тема: Re: Managing user files



 <Context docBase="/opt/winmail_storage/imgs" path="/imgs"/>

Thats all I added to my server.xml to get external img directory working:


      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
          <Context docBase="/opt/winmail_storage/imgs" path="/imgs"/>
</Host>



On Sun, Feb 6, 2011 at 5:34 PM, Josh Kehn <[hidden email]> wrote:

> That looks promising, I'll take a look when I'm less mobile.
> Regards,
>
> -Josh
> ___________________________
> http://joshuakehn.com
> Sent from my iPod
> On Feb 6, 2011, at 6:48 PM, Erik Pragt <[hidden email]> wrote:
>
> Hi Josh,
> Sorry, totally my bad. I mixed up some tutorials. I meant this
> one: http://grails.org/Simple+Avatar+Uploader
> In that tutorial, the images comes from the user, but you can easily change
> that (for example, to a location on disk), and read the bytes in from that
> location. You can do that easily using Commons IO:
> File file = new File("/my/custom/location/file.txt")
> InputStream is = new FileInputStream(file)
> byte[] bytes = IOUtils.toByteArray(is)
> Would that help more?
> Kind regards,
> Erik Pragt
>
>
>
> On 6 feb 2011, at 22:17, Joshua Kehn wrote:
>
> Erik-
> While informative that's not exactly what I'm looking for. Essentially I
> would like to server content from outside of the webapps directory.
> Regards,
> -Josh
> ____________________________________
> Joshua Kehn | [hidden email]
> http://joshuakehn.com
> On Feb 6, 2011, at 4:13 PM, Erik Pragt wrote:
>
> Hoi Josh,
> Take a look at this tutorial, I think it provides a good starting point:
> http://grails.org/File+Upload
> Kind regards,
> Erik Pragt
> http://www.jworks.nl
> On 6 feb 2011, at 21:57, Joshua Kehn wrote:
>
> Peter-



[Включено не все содержимое сообщения]