0

I finally found an example to upload both file and text data from Android to the server. It works only with additional libraries. My first question is how to parse received data on the server side? I could not find the format of the data. (I use Ansi C cgi-bin program).

I see that upload/download to the server from Android is a problem. I've already spent two days. I tried many examples. I tried this example. But it does not upload/download files more than about 4k. There are couple examples here They can upload file, but I can't find a way to send file name with the file body. Sending only file data without "what it is information" looks awful.

And my second question is as follows: what is the best way to send files to the server with some text data? Preferably without extra libraries. Thanks!

Community
  • 1
  • 1
Niaz
  • 545
  • 2
  • 12
  • 21
  • You just read from stdin. And react to boundaries and encoding. – greenapps Sep 07 '14 at 19:39
  • Yes, I know how to read all data on the server side. The question is how to parse it. I've analyzed the data on the server. The image starts after the word "binary" and 0xD,0xA,0D,0xA. But it would be interesting to know exact rules. Thanks. – Niaz Sep 08 '14 at 02:23
  • The exact rules are in a certain REF document of which i don't know the number from head. There is always a boundary, document type and encoding. Just save an email with attachments as eml file to disk and open with wordpad. The structure is the same. – greenapps Sep 08 '14 at 06:25
  • Mozilla thunderbird found an attachement file in such *.eml, but it can't open the image file. If the file is the same on different Android versions (I hope so), so I am okay and can find the image start offset in request. As text part of request I use image name field. Not beautiful solution, but it works. Is there any ways to send both text and file to server? Thanks. – Niaz Sep 08 '14 at 07:56
  • Ofcourse. There are many examples on this site. How come you didn't find them? They are mostly all for posting to a php script. But that does not matter. – greenapps Sep 08 '14 at 08:42

0 Answers0