Announcement Announcement Module
Collapse
No announcement yet.
Insert a picture (blob) into a SpringRoo project Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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...?

    Thanks
    Ratish S

    Comment


    • #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.

      Comment


      • #4
        field other --fieldName actualfile --type java.io.File

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

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

        Code:
        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:

        Code:
        <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.

        Comment


        • #5
          Possible solution

          Someone else asked a similar question in 2008:

          http://forum.springsource.org/showth...ile#post249115

          This page should hold your answers:

          http://static.springsource.org/sprin...#mvc-multipart

          Comment


          • #6
            Use the search, Luke

            Another thread about the same topic, with further details:

            http://forum.springsource.org/showthread.php?t=84286

            Comment

            Working...
            X