Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The resource directive is relative to the web apps root, so i don't think it will be able to access anything outside that.</p> <p>I'm not sure what you mean by there might not always be a server - there is always a server that the app runs on. If you mean database server I guess that is technically correct, although you could always use H2 or some other in-memory database at the very least.</p> <p>The <a href="http://grails.org/doc/latest/guide/theWebLayer.html#uploadingFiles" rel="nofollow">docs</a> have a pretty good section on file uploads. You could follow that and have it save the files to any directory you have access to - mapped or network or local. Probably best to do it outside the web app so you don't overwrite when you redeploy. Save the filename and whatever description you need to show the users.</p> <p>Then to access you will probably need to set up some sort of aliasing in your web server (tomcat, etc). So lets say you stored the docs at <code>/var/myWebApp/uploads</code> then you create an alias with the web server setup so that <code>/uploads/</code> points to <code>/var/myWebApp/uploads</code> and serve them up as <code>http://www.myserver.com/uploads/uploaded.pdf</code></p> <p>I don't know what security concerns you have for this site but you might want to obfuscate the file names if you are worried about people looking through the uploads directory, and don't allow that directory to show itself as an index and list the files it contains.</p> <p><em><strong>EDIT</em></strong></p> <p>Very basic example</p> <pre><code>//class class MyClass { String fileDescription byte[] fileDocument } //form &lt;g:uploadForm action="save"&gt; Description &lt;g:textField name="fileDescription" /&gt; &lt;input type="file" name="fileDocument" /&gt; &lt;input type="submit" &lt;/g:uploadForm&gt; //controller def save = { def myClass = new MyClass(params) myClass.save() } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload