FileUpload file format saved on database sql server 2008 with type Image

0

I have a problem finding the right encoding for a file that is saved to the database through FileUpload from asp.net on sql server 2008 with type Image. I need to migrate a web system to an Android application using a webservice in asp.net for communication with this sql server database, but the saved format is not corresponding with the already saved files. I do not understand if it is a matter of encoding (ASCII, UTF-8, ...) or problem with encode and base64 decode, or if it would be more appropriate to treat the file as hex.

The file is read by the system through the fileupload component:
arquivo.ARQUIVO = FileUpload1.FileBytes and then there's the rescue: contexto.SaveChanges()

The type expected by the database is Image and the web system reads the file normally after saving.

I need to do the same process through a native Android application (java), so I read the file, convert it to base64 to send it to the webservice that does the decode of the file and saves it in the same type in the database. When I compare the string of the file the string is different, so the web system understands it as a corrupted file, even though the application reads normally.

I have tried command.Parameters.Add("@ARQUIVO", SqlDbType.Image).Value = bytes; to save, but it seems to me that before this save the file format is no longer the same as the web system.

    
asked by anonymous 30.05.2018 / 15:02

0 answers