Announcement Announcement Module
No announcement yet.
Insert a picture (blob) into a SpringRoo project Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Insert a picture (blob) into a SpringRoo project

    Dear user,
    I'm new to Spring Roo and I was creating a small project following the simple instructions given in the reference doc.
    Now, what I would like to do is to allow the application to upload into the DB picture files (jpg, bmp, ...) and not only to upload data like strings, or integers.
    Does anybody knows how to do it?

    To be more clear:
    - In the context of the project of the pizza shop, suppose that the administrator of the application wants:
    1. to be able to upload on his DB the picture of the various pizzas;
    2. that the customers that access the application see the pictures of the various pizzas when accessing the page for the order.

    Thanks for your help

  • #2
    Insert a picture (blob)/ Upload an image and display the same

    I too have a similar requirement and am looking for a solution. Anybody got any leads...?

    Ratish S


    • #3
      I don't know if file uploading support is in the queue or not, but I dont see an option right now.

      You can look into file uploading part in the spring manual. This is where you will have to learn how spring controllers and validators work.


      • #4
        field other --fieldName actualfile --type

        I have similar requirements. In the roo shell I typed:

        field other --fieldName actualfile --type
        The generated .java RooEntity correctly includes the "actualFile" with its appropriate type:

        private File actualfile;
        However, the generated create.jspx uses a field:input tag instead of creating a file upload mechanism. I manually set render to false and z to user-managed and decided to write in a file upload box:

        <field:input render="false" field="actualfile" id="c_com_blah_Attachment_actualfile" z="user-managed"/>
        <input type="file" name="actualfile" size="50"> </input>
        It seems to save at least the filename with the entity. I'm not yet sure if it is persisting the file contents to the database or if there is a mechanism I can later allow downloading of the file.

        Will let you know if I find anything.


        • #5
          Possible solution

          Someone else asked a similar question in 2008:

          This page should hold your answers:


          • #6
            Use the search, Luke

            Another thread about the same topic, with further details: