Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Text file upload not stored as binary?

    Hi,

    The file upload example stores data as binary file (ds type="imageFile"). Is there a way to have the file treated and stored as a text file in the database?

    I'm using SQL Server on the back-end and would like store the file in a "text" DB column, which is more human-readable than using a binary "image" DB column.

    Thank you.

    #2
    How do you mean, base64 encoded or similar?

    You could do so by implementing a DMI to do the encode/decode.

    Comment


      #3
      I'm uploading a CSV file that was exported. Would be nice to have that more readable in the DB. But also not have to convert between string/binary elsewhere in my code when I now it's always text.

      Comment


        #4
        What you could do is declare a field as "binary" and set customSQL="true", then SmartGWT will not try to generate SQL code for that field. The binary field will result in a FileItem, and the uploaded file will arrive as an InputStream available from dsRequest.getUploadFile().

        From there, you could stream it into a String, and call setFieldValue() to populate it as the value for an ordinary field of type "text", and cell dsRequest.execute() to have it stored automatically.

        Comment


          #5
          Ok, thank you.

          Comment

          Working...
          X