Grails File Upload + tagLib - grails

If I want to change create my Tag Library for file Upload via ajax, then what changes I have to make into tag in grails.
I have code for file upload via ajax and using that I want to create tag library which upload file and also submit form through ajax...
what I have do for that??

Have you run this command? This creates the necessary files and you just actually write code in those files. Bascially you just genereate HTML in those. Here is an example of a taglib http://www.howardism.org/Technical/Groovy/Useful_Taglibs.html
Hope this helps !!!

Related

How to open a file from Grails app using <a> tag?

This is my first Grails project & I can't seem to do this very simple thing! I am trying to display a list of PDF forms in one page that I have saved under a folder called forms under my_project/grails-app/views/forms and want to open the PDF form in a new window when clicked.
In my .gsp file I am trying to access the forms like this:
Form #1
But that's giving me a 404 error.
I have found couple of solutions like this one or this question (which is very similar to mine)...but first of all, i don't need to upload/download the file. Second, i don't need to render the file either. All I want to do is just click the link and open the PDF file in a new window/tab. Am I saving the PDF files in a wrong place? Please help!! Thank you.
Place your file/directory into grails-app/assets so that you have grails-app/assets/forms/form_one.pdf then you can use the resource tag like this:
Form #1
The grails-app/views directory is used for views rendered by controllers, where as the grails-app/assets directory is used for static and pre-processed assets.

ASP.NET MVC HttpPostedFileBase pass file to server without input file

I wonder if there is a posibility not to use input file tag and pass file to server. For example, i want to pass image that is shown in <img /> tag.
You can use the javascript XHR object to upload a file to the server. This approach does not use HttpPostedFileBase. There's a good example of how to do it here: File API File Upload - Read XMLHttpRequest in ASP.NET MVC

Grails is it possible to protect the .gsp files?

I know we can deploy Grails application with .war file, just like in this wiki : http://grails.org/Deployment but the view files (the .gsp files) is still on a plain text. I want to protect my .gsp code, any suggestion?
How do you mean protect, do you want to make sure that users can't see the GSP code? That's not possible, just like for JSPs, since the server won't send down source code to the browser, only rendered output from GSPs/JSPs.
If you want to guard access to particular GSP URLs, use http://grails.org/plugin/spring-security-core or http://grails.org/plugin/shiro

.Net MVC file upload control in modal popup and save using $.post

I an trying to upload file using modal popup. I couldn't get uploaded file in controller.
I placed file upload control in model popup and used $.post to save that file.
Please suggest me your thoughts, It's possible or not?
Thanks!
No, out of the box $.post cannot be used to upload files. You could use some of the available file upload plugins such as jQuery.form or Blueimp file upload.

embed javascript to a jasper report pdf?

I want to embed a javascript function into a pdf file generated by jasper.
it comes to my mind because I want to make the pdf file auto open printing dialog.
after reading this question and tried this example I want to do the same.
but I use iReport designer to create my pdf templates and then export using struts actions, any idea how to embed javascript with ireport?
thanks
You can try to use the net.sf.jasperreports.export.pdf.javascript property.
The information about this property is here.

Resources