[android-developers] Re: Corrupted images when uploading to server via POST
and how will it help me with the actual problem? read my posts #1 and #6. the question isn't about "how to send multipart data" as it is quite a trivial tast itself. On 18 фев, 09:16, gjs wrote: > Hi, > > Take a look through these... > > http://www.google.com.au/#hl=en&xhr=t&q=android+http+multipart+upload... > > Regards > > On Feb 17, 11:43 pm, alex c wrote: > > > i cannot believe i am the only "luck" person who experiences this... > > =) hoped to find a solution here :( > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Corrupted images when uploading to server via POST
Hi, Take a look through these... http://www.google.com.au/#hl=en&xhr=t&q=android+http+multipart+upload+example&cp=37&pf=p&sclient=psy&aq=f&aqi=&aql=&oq=android+http+multipart+upload+example&pbx=1&fp=b56462fbc30bae12 Regards On Feb 17, 11:43 pm, alex c wrote: > i cannot believe i am the only "luck" person who experiences this... > =) hoped to find a solution here :( -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Corrupted images when uploading to server via POST
i cannot believe i am the only "luck" person who experiences this... =) hoped to find a solution here :( -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Corrupted images when uploading to server via POST
yeah. that post on stackoverflow was actually mine =) and after not getting any useful replies on there i decided to post it here i tried to create multipart bundle myself and actually it was much easier to debug the output. it doesn't matter what i use. the tcpdump on android is perfect. tcpdump on receiving server (tried multiple servers) is corrupt. if you look at post message #6 in this post - there is a detailed explanation of what is happening on both ends. so i still think it's something with android, cause i am just not able to break such an easy piece of code =) On 16 фев, 15:44, Miguel Morales wrote: > Bah, sorry it's late. Noticed you are using DefaultHTTPClient. In > any case, have you tried setting the multi-part header yourself? Did > you see it set when you were using tcpdump? > > > > On Wed, Feb 16, 2011 at 4:35 AM, Miguel Morales > wrote: > > Sorry, missed the part where you already tried URLConnection. > > You should post that code here, because using non-standard classes, > > specially for network communication, is not recommended. > > > On Wed, Feb 16, 2011 at 4:23 AM, Miguel Morales > > wrote: > >> Try setting the multipart/form-data header in your connection. Might > >> be easy to use HTTPUrlConnection. > >> See:http://stackoverflow.com/questions/4896949/android-httpclient-file-up... > > >> On Wed, Feb 16, 2011 at 2:38 AM, alex c wrote: > >>> not exactly > >>> i experience this same problem on my slow 3G (Megafon) connection too, > >>> but don't have this on WIFI or wire network. > > >>> but! if i connect my laptop to internet via my phone (winmobile 6.5) > >>> 3g connection, it works perfect. a bit slow, but none of content i see > >>> on laptop is corrupt. > >>> i haven't really tried to connect laptop via android phone though. > > >>> so it's definitely not a problem with internet provider. and basically > >>> this all sounds fantastic. tcp has error correction and it shouldn't > >>> corrupt data by any means. but what i see is what i see.. it's > >>> strange, but it is happening > > >>> On 16 фев, 12:13, Kostya Vasilyev wrote: > Alex, > > Ok, let's see if I understand it: > > - Your clients are having this problem with data corruption; > > - You are not having this problem, the code works just fine every time. > > Right? If so, let me go on: > > - Your clients use some kind of "slow WiFi" and experience data > corruption between the phone and the server; > > - You have logged what you send, and the data you send is correct. > > If those are the facts, then > > - It's a problem with your client's network. > > Wikipedia says there is only one internet (and mobile) provider in > Andorra, perhaps your clients could drive a few miles into France or > Spain, find a McDonalds with free WiFi, and test your application there? > > -- Kostya > > 16.02.2011 11:56, alex c пишет: > > > yeah. i tried it with WIFI and via tethering through usb to my laptop > > pppoe connection. and it works. fine. > > but the problem is that my clients use quite slow wifi connection in > > Andorra and they have this same issue and images they upload though > > app get almost 100% corrupt. > > > as for htc hd2 - yeah, you are correct. it's 3rd party firmware, but > > at least it is something real and not an emulator (which, in fact, > > works perfect via pppoe connection). > > my cilents are using samsung galaxy tab (as i mentioned in the first > > post) with android 2.2 and having same issue. this is why i started to > > investigate it and finished up with this post. > > > as for mime type headers - i was just experimenting with it, thinkign > > that maybe it was due to incorrect mime type before i switched to > > base64 and had these stange results. btw, 2 times i got an extremely > > strange result: i found pieces of some crap texts in the base64 post > > (at apache's end). and it seems like with this big MTU value the > > device (or some router on the path) messes tcp packets from different > > sections. > > > i was thinking about wrong MTU path discovery implementation in froyo, > > or something like this... > > > On 16 фев, 00:36, Kostya Vasilyev wrote: > >> Alex, > > >> I don't think you need to call addHeader with the content type here. > > >> Other than that, have you tried testing with different network > >> connectivity options? (mobile with different networks, WiFi though > >> different routers). > > >> Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are > >> you testing your code with a custom Android build made for that phone? > >> If that's the case and you didn't mean the Desire HD, try a device > >> that > >> has vendor-supplied Android firmware. > > >> -- Kostya > > >> 14.02.2011 10:25, alex c пишет: > > >>>
Re: [android-developers] Re: Corrupted images when uploading to server via POST
Bah, sorry it's late. Noticed you are using DefaultHTTPClient. In any case, have you tried setting the multi-part header yourself? Did you see it set when you were using tcpdump? On Wed, Feb 16, 2011 at 4:35 AM, Miguel Morales wrote: > Sorry, missed the part where you already tried URLConnection. > You should post that code here, because using non-standard classes, > specially for network communication, is not recommended. > > On Wed, Feb 16, 2011 at 4:23 AM, Miguel Morales > wrote: >> Try setting the multipart/form-data header in your connection. Might >> be easy to use HTTPUrlConnection. >> See: >> http://stackoverflow.com/questions/4896949/android-httpclient-file-upload-data-corruption-and-timeout-issues >> >> On Wed, Feb 16, 2011 at 2:38 AM, alex c wrote: >>> not exactly >>> i experience this same problem on my slow 3G (Megafon) connection too, >>> but don't have this on WIFI or wire network. >>> >>> but! if i connect my laptop to internet via my phone (winmobile 6.5) >>> 3g connection, it works perfect. a bit slow, but none of content i see >>> on laptop is corrupt. >>> i haven't really tried to connect laptop via android phone though. >>> >>> so it's definitely not a problem with internet provider. and basically >>> this all sounds fantastic. tcp has error correction and it shouldn't >>> corrupt data by any means. but what i see is what i see.. it's >>> strange, but it is happening >>> >>> On 16 фев, 12:13, Kostya Vasilyev wrote: Alex, Ok, let's see if I understand it: - Your clients are having this problem with data corruption; - You are not having this problem, the code works just fine every time. Right? If so, let me go on: - Your clients use some kind of "slow WiFi" and experience data corruption between the phone and the server; - You have logged what you send, and the data you send is correct. If those are the facts, then - It's a problem with your client's network. Wikipedia says there is only one internet (and mobile) provider in Andorra, perhaps your clients could drive a few miles into France or Spain, find a McDonalds with free WiFi, and test your application there? -- Kostya 16.02.2011 11:56, alex c пишет: > yeah. i tried it with WIFI and via tethering through usb to my laptop > pppoe connection. and it works. fine. > but the problem is that my clients use quite slow wifi connection in > Andorra and they have this same issue and images they upload though > app get almost 100% corrupt. > as for htc hd2 - yeah, you are correct. it's 3rd party firmware, but > at least it is something real and not an emulator (which, in fact, > works perfect via pppoe connection). > my cilents are using samsung galaxy tab (as i mentioned in the first > post) with android 2.2 and having same issue. this is why i started to > investigate it and finished up with this post. > as for mime type headers - i was just experimenting with it, thinkign > that maybe it was due to incorrect mime type before i switched to > base64 and had these stange results. btw, 2 times i got an extremely > strange result: i found pieces of some crap texts in the base64 post > (at apache's end). and it seems like with this big MTU value the > device (or some router on the path) messes tcp packets from different > sections. > i was thinking about wrong MTU path discovery implementation in froyo, > or something like this... > On 16 фев, 00:36, Kostya Vasilyev wrote: >> Alex, >> I don't think you need to call addHeader with the content type here. >> Other than that, have you tried testing with different network >> connectivity options? (mobile with different networks, WiFi though >> different routers). >> Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are >> you testing your code with a custom Android build made for that phone? >> If that's the case and you didn't mean the Desire HD, try a device that >> has vendor-supplied Android firmware. >> -- Kostya >> 14.02.2011 10:25, alex c пишет: >>> HttpPost post = new HttpPost(uri); >>> post.addHeader(entity.getContentType()); >>> post.setEntity(entity); >>> HttpResponse resp = mHttpClient.execute(post); >> -- >> Kostya Vasilyev --http://kmansoft.wordpress.com -- Kostya Vasilyev --http://kmansoft.wordpress.com >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to android-developers@googlegroups.com >>> To unsubscribe from this group, send email to >>> android-developers+unsubscr...@goog
Re: [android-developers] Re: Corrupted images when uploading to server via POST
Sorry, missed the part where you already tried URLConnection. You should post that code here, because using non-standard classes, specially for network communication, is not recommended. On Wed, Feb 16, 2011 at 4:23 AM, Miguel Morales wrote: > Try setting the multipart/form-data header in your connection. Might > be easy to use HTTPUrlConnection. > See: > http://stackoverflow.com/questions/4896949/android-httpclient-file-upload-data-corruption-and-timeout-issues > > On Wed, Feb 16, 2011 at 2:38 AM, alex c wrote: >> not exactly >> i experience this same problem on my slow 3G (Megafon) connection too, >> but don't have this on WIFI or wire network. >> >> but! if i connect my laptop to internet via my phone (winmobile 6.5) >> 3g connection, it works perfect. a bit slow, but none of content i see >> on laptop is corrupt. >> i haven't really tried to connect laptop via android phone though. >> >> so it's definitely not a problem with internet provider. and basically >> this all sounds fantastic. tcp has error correction and it shouldn't >> corrupt data by any means. but what i see is what i see.. it's >> strange, but it is happening >> >> On 16 фев, 12:13, Kostya Vasilyev wrote: >>> Alex, >>> >>> Ok, let's see if I understand it: >>> >>> - Your clients are having this problem with data corruption; >>> >>> - You are not having this problem, the code works just fine every time. >>> >>> Right? If so, let me go on: >>> >>> - Your clients use some kind of "slow WiFi" and experience data >>> corruption between the phone and the server; >>> >>> - You have logged what you send, and the data you send is correct. >>> >>> If those are the facts, then >>> >>> - It's a problem with your client's network. >>> >>> Wikipedia says there is only one internet (and mobile) provider in >>> Andorra, perhaps your clients could drive a few miles into France or >>> Spain, find a McDonalds with free WiFi, and test your application there? >>> >>> -- Kostya >>> >>> 16.02.2011 11:56, alex c пишет: >>> >>> >>> >>> > yeah. i tried it with WIFI and via tethering through usb to my laptop >>> > pppoe connection. and it works. fine. >>> > but the problem is that my clients use quite slow wifi connection in >>> > Andorra and they have this same issue and images they upload though >>> > app get almost 100% corrupt. >>> >>> > as for htc hd2 - yeah, you are correct. it's 3rd party firmware, but >>> > at least it is something real and not an emulator (which, in fact, >>> > works perfect via pppoe connection). >>> > my cilents are using samsung galaxy tab (as i mentioned in the first >>> > post) with android 2.2 and having same issue. this is why i started to >>> > investigate it and finished up with this post. >>> >>> > as for mime type headers - i was just experimenting with it, thinkign >>> > that maybe it was due to incorrect mime type before i switched to >>> > base64 and had these stange results. btw, 2 times i got an extremely >>> > strange result: i found pieces of some crap texts in the base64 post >>> > (at apache's end). and it seems like with this big MTU value the >>> > device (or some router on the path) messes tcp packets from different >>> > sections. >>> >>> > i was thinking about wrong MTU path discovery implementation in froyo, >>> > or something like this... >>> >>> > On 16 фев, 00:36, Kostya Vasilyev wrote: >>> >> Alex, >>> >>> >> I don't think you need to call addHeader with the content type here. >>> >>> >> Other than that, have you tried testing with different network >>> >> connectivity options? (mobile with different networks, WiFi though >>> >> different routers). >>> >>> >> Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are >>> >> you testing your code with a custom Android build made for that phone? >>> >> If that's the case and you didn't mean the Desire HD, try a device that >>> >> has vendor-supplied Android firmware. >>> >>> >> -- Kostya >>> >>> >> 14.02.2011 10:25, alex c пишет: >>> >>> >>> HttpPost post = new HttpPost(uri); >>> >>> post.addHeader(entity.getContentType()); >>> >>> post.setEntity(entity); >>> >>> HttpResponse resp = mHttpClient.execute(post); >>> >> -- >>> >> Kostya Vasilyev --http://kmansoft.wordpress.com >>> >>> -- >>> Kostya Vasilyev --http://kmansoft.wordpress.com >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > -- > ~ Jeremiah:9:23-24 > Android 2D MMORPG: http://developingthedream.blogspot.com/, > http://www.youtube.com/user/revoltingx > -- ~ Jeremiah:9:23-24 Android 2D MMORPG: http://developingthedream.blogspot.com/, http://www.youtube.com/u
Re: [android-developers] Re: Corrupted images when uploading to server via POST
Try setting the multipart/form-data header in your connection. Might be easy to use HTTPUrlConnection. See: http://stackoverflow.com/questions/4896949/android-httpclient-file-upload-data-corruption-and-timeout-issues On Wed, Feb 16, 2011 at 2:38 AM, alex c wrote: > not exactly > i experience this same problem on my slow 3G (Megafon) connection too, > but don't have this on WIFI or wire network. > > but! if i connect my laptop to internet via my phone (winmobile 6.5) > 3g connection, it works perfect. a bit slow, but none of content i see > on laptop is corrupt. > i haven't really tried to connect laptop via android phone though. > > so it's definitely not a problem with internet provider. and basically > this all sounds fantastic. tcp has error correction and it shouldn't > corrupt data by any means. but what i see is what i see.. it's > strange, but it is happening > > On 16 фев, 12:13, Kostya Vasilyev wrote: >> Alex, >> >> Ok, let's see if I understand it: >> >> - Your clients are having this problem with data corruption; >> >> - You are not having this problem, the code works just fine every time. >> >> Right? If so, let me go on: >> >> - Your clients use some kind of "slow WiFi" and experience data >> corruption between the phone and the server; >> >> - You have logged what you send, and the data you send is correct. >> >> If those are the facts, then >> >> - It's a problem with your client's network. >> >> Wikipedia says there is only one internet (and mobile) provider in >> Andorra, perhaps your clients could drive a few miles into France or >> Spain, find a McDonalds with free WiFi, and test your application there? >> >> -- Kostya >> >> 16.02.2011 11:56, alex c пишет: >> >> >> >> > yeah. i tried it with WIFI and via tethering through usb to my laptop >> > pppoe connection. and it works. fine. >> > but the problem is that my clients use quite slow wifi connection in >> > Andorra and they have this same issue and images they upload though >> > app get almost 100% corrupt. >> >> > as for htc hd2 - yeah, you are correct. it's 3rd party firmware, but >> > at least it is something real and not an emulator (which, in fact, >> > works perfect via pppoe connection). >> > my cilents are using samsung galaxy tab (as i mentioned in the first >> > post) with android 2.2 and having same issue. this is why i started to >> > investigate it and finished up with this post. >> >> > as for mime type headers - i was just experimenting with it, thinkign >> > that maybe it was due to incorrect mime type before i switched to >> > base64 and had these stange results. btw, 2 times i got an extremely >> > strange result: i found pieces of some crap texts in the base64 post >> > (at apache's end). and it seems like with this big MTU value the >> > device (or some router on the path) messes tcp packets from different >> > sections. >> >> > i was thinking about wrong MTU path discovery implementation in froyo, >> > or something like this... >> >> > On 16 фев, 00:36, Kostya Vasilyev wrote: >> >> Alex, >> >> >> I don't think you need to call addHeader with the content type here. >> >> >> Other than that, have you tried testing with different network >> >> connectivity options? (mobile with different networks, WiFi though >> >> different routers). >> >> >> Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are >> >> you testing your code with a custom Android build made for that phone? >> >> If that's the case and you didn't mean the Desire HD, try a device that >> >> has vendor-supplied Android firmware. >> >> >> -- Kostya >> >> >> 14.02.2011 10:25, alex c пишет: >> >> >>> HttpPost post = new HttpPost(uri); >> >>> post.addHeader(entity.getContentType()); >> >>> post.setEntity(entity); >> >>> HttpResponse resp = mHttpClient.execute(post); >> >> -- >> >> Kostya Vasilyev --http://kmansoft.wordpress.com >> >> -- >> Kostya Vasilyev --http://kmansoft.wordpress.com > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- ~ Jeremiah:9:23-24 Android 2D MMORPG: http://developingthedream.blogspot.com/, http://www.youtube.com/user/revoltingx -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Corrupted images when uploading to server via POST
not exactly i experience this same problem on my slow 3G (Megafon) connection too, but don't have this on WIFI or wire network. but! if i connect my laptop to internet via my phone (winmobile 6.5) 3g connection, it works perfect. a bit slow, but none of content i see on laptop is corrupt. i haven't really tried to connect laptop via android phone though. so it's definitely not a problem with internet provider. and basically this all sounds fantastic. tcp has error correction and it shouldn't corrupt data by any means. but what i see is what i see.. it's strange, but it is happening On 16 фев, 12:13, Kostya Vasilyev wrote: > Alex, > > Ok, let's see if I understand it: > > - Your clients are having this problem with data corruption; > > - You are not having this problem, the code works just fine every time. > > Right? If so, let me go on: > > - Your clients use some kind of "slow WiFi" and experience data > corruption between the phone and the server; > > - You have logged what you send, and the data you send is correct. > > If those are the facts, then > > - It's a problem with your client's network. > > Wikipedia says there is only one internet (and mobile) provider in > Andorra, perhaps your clients could drive a few miles into France or > Spain, find a McDonalds with free WiFi, and test your application there? > > -- Kostya > > 16.02.2011 11:56, alex c пишет: > > > > > yeah. i tried it with WIFI and via tethering through usb to my laptop > > pppoe connection. and it works. fine. > > but the problem is that my clients use quite slow wifi connection in > > Andorra and they have this same issue and images they upload though > > app get almost 100% corrupt. > > > as for htc hd2 - yeah, you are correct. it's 3rd party firmware, but > > at least it is something real and not an emulator (which, in fact, > > works perfect via pppoe connection). > > my cilents are using samsung galaxy tab (as i mentioned in the first > > post) with android 2.2 and having same issue. this is why i started to > > investigate it and finished up with this post. > > > as for mime type headers - i was just experimenting with it, thinkign > > that maybe it was due to incorrect mime type before i switched to > > base64 and had these stange results. btw, 2 times i got an extremely > > strange result: i found pieces of some crap texts in the base64 post > > (at apache's end). and it seems like with this big MTU value the > > device (or some router on the path) messes tcp packets from different > > sections. > > > i was thinking about wrong MTU path discovery implementation in froyo, > > or something like this... > > > On 16 фев, 00:36, Kostya Vasilyev wrote: > >> Alex, > > >> I don't think you need to call addHeader with the content type here. > > >> Other than that, have you tried testing with different network > >> connectivity options? (mobile with different networks, WiFi though > >> different routers). > > >> Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are > >> you testing your code with a custom Android build made for that phone? > >> If that's the case and you didn't mean the Desire HD, try a device that > >> has vendor-supplied Android firmware. > > >> -- Kostya > > >> 14.02.2011 10:25, alex c пишет: > > >>> HttpPost post = new HttpPost(uri); > >>> post.addHeader(entity.getContentType()); > >>> post.setEntity(entity); > >>> HttpResponse resp = mHttpClient.execute(post); > >> -- > >> Kostya Vasilyev --http://kmansoft.wordpress.com > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Corrupted images when uploading to server via POST
Alex, Ok, let's see if I understand it: - Your clients are having this problem with data corruption; - You are not having this problem, the code works just fine every time. Right? If so, let me go on: - Your clients use some kind of "slow WiFi" and experience data corruption between the phone and the server; - You have logged what you send, and the data you send is correct. If those are the facts, then - It's a problem with your client's network. Wikipedia says there is only one internet (and mobile) provider in Andorra, perhaps your clients could drive a few miles into France or Spain, find a McDonalds with free WiFi, and test your application there? -- Kostya 16.02.2011 11:56, alex c пишет: yeah. i tried it with WIFI and via tethering through usb to my laptop pppoe connection. and it works. fine. but the problem is that my clients use quite slow wifi connection in Andorra and they have this same issue and images they upload though app get almost 100% corrupt. as for htc hd2 - yeah, you are correct. it's 3rd party firmware, but at least it is something real and not an emulator (which, in fact, works perfect via pppoe connection). my cilents are using samsung galaxy tab (as i mentioned in the first post) with android 2.2 and having same issue. this is why i started to investigate it and finished up with this post. as for mime type headers - i was just experimenting with it, thinkign that maybe it was due to incorrect mime type before i switched to base64 and had these stange results. btw, 2 times i got an extremely strange result: i found pieces of some crap texts in the base64 post (at apache's end). and it seems like with this big MTU value the device (or some router on the path) messes tcp packets from different sections. i was thinking about wrong MTU path discovery implementation in froyo, or something like this... On 16 фев, 00:36, Kostya Vasilyev wrote: Alex, I don't think you need to call addHeader with the content type here. Other than that, have you tried testing with different network connectivity options? (mobile with different networks, WiFi though different routers). Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are you testing your code with a custom Android build made for that phone? If that's the case and you didn't mean the Desire HD, try a device that has vendor-supplied Android firmware. -- Kostya 14.02.2011 10:25, alex c пишет: HttpPost post = new HttpPost(uri); post.addHeader(entity.getContentType()); post.setEntity(entity); HttpResponse resp = mHttpClient.execute(post); -- Kostya Vasilyev --http://kmansoft.wordpress.com -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Corrupted images when uploading to server via POST
yeah. i tried it with WIFI and via tethering through usb to my laptop pppoe connection. and it works. fine. but the problem is that my clients use quite slow wifi connection in Andorra and they have this same issue and images they upload though app get almost 100% corrupt. as for htc hd2 - yeah, you are correct. it's 3rd party firmware, but at least it is something real and not an emulator (which, in fact, works perfect via pppoe connection). my cilents are using samsung galaxy tab (as i mentioned in the first post) with android 2.2 and having same issue. this is why i started to investigate it and finished up with this post. as for mime type headers - i was just experimenting with it, thinkign that maybe it was due to incorrect mime type before i switched to base64 and had these stange results. btw, 2 times i got an extremely strange result: i found pieces of some crap texts in the base64 post (at apache's end). and it seems like with this big MTU value the device (or some router on the path) messes tcp packets from different sections. i was thinking about wrong MTU path discovery implementation in froyo, or something like this... On 16 фев, 00:36, Kostya Vasilyev wrote: > Alex, > > I don't think you need to call addHeader with the content type here. > > Other than that, have you tried testing with different network > connectivity options? (mobile with different networks, WiFi though > different routers). > > Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are > you testing your code with a custom Android build made for that phone? > If that's the case and you didn't mean the Desire HD, try a device that > has vendor-supplied Android firmware. > > -- Kostya > > 14.02.2011 10:25, alex c пишет: > > > HttpPost post = new HttpPost(uri); > > post.addHeader(entity.getContentType()); > > post.setEntity(entity); > > HttpResponse resp = mHttpClient.execute(post); > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Corrupted images when uploading to server via POST
Alex, I don't think you need to call addHeader with the content type here. Other than that, have you tried testing with different network connectivity options? (mobile with different networks, WiFi though different routers). Finally, you mentioned an HTC HD2 - that's a Windows Mobile phone, are you testing your code with a custom Android build made for that phone? If that's the case and you didn't mean the Desire HD, try a device that has vendor-supplied Android firmware. -- Kostya 14.02.2011 10:25, alex c пишет: HttpPost post = new HttpPost(uri); post.addHeader(entity.getContentType()); post.setEntity(entity); HttpResponse resp = mHttpClient.execute(post); -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Corrupted images when uploading to server via POST
not really sure if this group owners are still pre-moderating me or i just clicked a wrong button On 12 фев, 13:25, Kostya Vasilyev wrote: > This: > > HttpResponse resp =*NetworkUtils.sendHttpRequestMultipart*(exportUrl, > reqEntity); > > does not look like an Android SDK fuction. > > Without seeing the code for it, we can only guess. > > -- Kostya > > 12.02.2011 13:11, Gergely Juh�sz ?: > > > > > yes a iknow, but if he maybe get an ANR, the images could be corrupted > > if not fully uploads them. > > of corse he didn't write anything about he would have an ANR. > > > On 12 February 2011 09:35, Indicator Veritatis wrote: > >> You are right, it is a bad idea to do it in the UI thread, but his > >> problem is not the problem one would expect from doing it in a UI > >> thread. That is, given that his failure takes place in his existing > >> code, I would expect the same failure to take place once he has moved > >> it to a worker thread. > > >> After all, the error we expect due to doing network in the UI thread > >> is the infamous ANR. But that is not what he is getting. He is getting > >> missing stuff in the uploaded files. > > >> On Feb 11, 3:41 pm, Gergely Juh�sz wrote: > >>> It is a realy bad idea to make network communication in the ui thread. > >>> You should always make net io in a worker thread. > > >>> On 8 February 2011 15:45, alex c wrote: > > ello. > i'm experiencing a problem when uploading images from my android > application to remote server (apache with php). > devices are: htc hd2 and samsung galaxy tab. all with android 2.2 > the application itself is very simple: > public class UploadTest extends Activity { > private final static String TAG = "UploadTest"; > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > } > private void uploadImage() { > String imagePath = > Environment.getExternalStorageDirectory() > + "/Andorra/Images/748.jpg"; > String exportUrl = > "http://domainname.here/pda/export_photos.php";; > String responseStr = ""; > MultipartEntity reqEntity = new > MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); > reqEntity.addPart("image", new FileBody(new > File(imagePath), "image/ > jpeg")); > HttpResponse resp = > NetworkUtils.sendHttpRequestMultipart(exportUrl, > reqEntity); > new AlertDialog.Builder(this).setMessage(responseStr) > .setTitle("Finished") > .setPositiveButton("Ok", new > DialogInterface.OnClickListener() { > public void > onClick(DialogInterface dialog, int whichButton) { > } > }).show(); > } > public void btn1_onClickHandler(View v) { > uploadImage(); > } > } > so it's as simple as it can be. > the problem is that the uploaded image is corrupted. > the file size is same. but content can differ. sometimes it uploads > ok. sometimes it is broken.. > example: > original image;http://pixelbirthcloud.com/corrupted_images/1_orig.jpg > uplaoded > image:http://pixelbirthcloud.com/corrupted_images/1_corrupted.jpg > the binary diff says: > > 00051330 | 49 69 11 4B 9D E6 | 00051330 | DA BB 10 70 DC 77 | > 00051338 | 2D B9 1B B9 E4 81 5A E6 | 00051338 | AC 20 C7 90 7E B4 33 > 80 | > 00051340 | D4 14 B0 F4 EA 3D D1 E9 | 00051340 | 31 9A B8 C2 29 83 66 > 9C | > 00051348 | 61 9D E3 38 F7 36 DE 63 | 00051348 | 9A 84 8E 73 9A 8D B5 > 29 | > 00051350 | 25 9D 9D C4 64 C3 23 AA | 00051350 | 18 60 1C 0F 7A CF 33 > 01 | > 00051358 | 4A EB 08 C3 97 7C 8C 36 | 00051358 | D4 F0 7A D3 24 BA 85 > 71 | > 00051360 | 73 F5 E3 15 14 5B BC C1 | 00051360 | F3 0A 76 8A D6 C4 36 > 5E | > 00051368 | B9 A4 49 06 71 1B 11 87 | 00051368 | 7B B9 5F 20 E3 A5 46 > F2 | > 00051370 | 39 E7 76 7B 8F 5F | 00051370 | B8 1D 4E 6B 36 6D | > > internet connection is 3g in my case and slow wifi in client's case. > for client the images are 90% corrupted (cannot see anything) and it > happens like 98% of the time. > after some time i tried to make the upload using HttpURLConnection > class and had same results. >
[android-developers] Re: Corrupted images when uploading to server via POST
ok. sorry for delay. i haven't realized that the message was already approved.. 1) the UI thread. it is just a test application i made so i would be sure that nothing else affects is.. the main application i experience problems with is quite big and surely all network communication is made in a separate thread 2) i have no idea what ARN is, but the file size is ok and nothing is missing within the file. what i get is some blocks within a file are corrupted 3) sendmultipart - you are correct... it's not a part of android sdk. sorry. i missed the code. =) here it is: HttpClient mHttpClient = new DefaultHttpClient(); final HttpParams params = mHttpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, REGISTRATION_TIMEOUT); HttpConnectionParams.setSoTimeout(params, WAIT_TIMEOUT); ConnManagerParams.setTimeout(params, WAIT_TIMEOUT); HttpPost post = new HttpPost(uri); post.addHeader(entity.getContentType()); post.setEntity(entity); HttpResponse resp = mHttpClient.execute(post); basically, it doesn't matter, cause i tried to perform network operations using HttpUrlConnection and creating mulripart bundle by hands and experienced same result 4) i was heavily testing it on thursday/friday and here is what i have found: the tcpdump on android device shows correct data. the tcpdumb on the receiving machine shows corrupted data. but! on android device the MTU is 1516 somehow, which is quite big i assume. on the server packets received are 1514 bytes.. and when i lower MTU to 576 (whihc, i believe should be default to PPP), it works PERFECT! so the problem is somewhere in a weak tcp/ip stack implementation in froyo. this doesn't solve the problem though, cause changing MTU is done manually each time the interface is up. so i cannot do it with my clients' devices. i also tried to set chunked mode to send packets of 300 or 400 bytes (should be like 700 bytes with all http headers i think). but it did't give any result :( any ideas of how it can be fixed? :) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Corrupted images when uploading to server via POST
This: HttpResponse resp =*NetworkUtils.sendHttpRequestMultipart*(exportUrl, reqEntity); does not look like an Android SDK fuction. Without seeing the code for it, we can only guess. -- Kostya 12.02.2011 13:11, Gergely Juhász ?: yes a iknow, but if he maybe get an ANR, the images could be corrupted if not fully uploads them. of corse he didn't write anything about he would have an ANR. On 12 February 2011 09:35, Indicator Veritatis wrote: You are right, it is a bad idea to do it in the UI thread, but his problem is not the problem one would expect from doing it in a UI thread. That is, given that his failure takes place in his existing code, I would expect the same failure to take place once he has moved it to a worker thread. After all, the error we expect due to doing network in the UI thread is the infamous ANR. But that is not what he is getting. He is getting missing stuff in the uploaded files. On Feb 11, 3:41 pm, Gergely Juhász wrote: It is a realy bad idea to make network communication in the ui thread. You should always make net io in a worker thread. On 8 February 2011 15:45, alex c wrote: ello. i'm experiencing a problem when uploading images from my android application to remote server (apache with php). devices are: htc hd2 and samsung galaxy tab. all with android 2.2 the application itself is very simple: public class UploadTest extends Activity { private final static String TAG = "UploadTest"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } private void uploadImage() { String imagePath = Environment.getExternalStorageDirectory() + "/Andorra/Images/748.jpg"; String exportUrl = "http://domainname.here/pda/export_photos.php";; String responseStr = ""; MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); reqEntity.addPart("image", new FileBody(new File(imagePath), "image/ jpeg")); HttpResponse resp = NetworkUtils.sendHttpRequestMultipart(exportUrl, reqEntity); new AlertDialog.Builder(this).setMessage(responseStr) .setTitle("Finished") .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).show(); } public void btn1_onClickHandler(View v) { uploadImage(); } } so it's as simple as it can be. the problem is that the uploaded image is corrupted. the file size is same. but content can differ. sometimes it uploads ok. sometimes it is broken.. example: original image;http://pixelbirthcloud.com/corrupted_images/1_orig.jpg uplaoded image:http://pixelbirthcloud.com/corrupted_images/1_corrupted.jpg the binary diff says: 00051330 | 49 69 11 4B 9D E6 | 00051330 | DA BB 10 70 DC 77 | 00051338 | 2D B9 1B B9 E4 81 5A E6 | 00051338 | AC 20 C7 90 7E B4 33 80 | 00051340 | D4 14 B0 F4 EA 3D D1 E9 | 00051340 | 31 9A B8 C2 29 83 66 9C | 00051348 | 61 9D E3 38 F7 36 DE 63 | 00051348 | 9A 84 8E 73 9A 8D B5 29 | 00051350 | 25 9D 9D C4 64 C3 23 AA | 00051350 | 18 60 1C 0F 7A CF 33 01 | 00051358 | 4A EB 08 C3 97 7C 8C 36 | 00051358 | D4 F0 7A D3 24 BA 85 71 | 00051360 | 73 F5 E3 15 14 5B BC C1 | 00051360 | F3 0A 76 8A D6 C4 36 5E | 00051368 | B9 A4 49 06 71 1B 11 87 | 00051368 | 7B B9 5F 20 E3 A5 46 F2 | 00051370 | 39 E7 76 7B 8F 5F | 00051370 | B8 1D 4E 6B 36 6D | internet connection is 3g in my case and slow wifi in client's case. for client the images are 90% corrupted (cannot see anything) and it happens like 98% of the time. after some time i tried to make the upload using HttpURLConnection class and had same results. then tried to encode files with base64 but even in this case the base64 text is received corrupted. also tries to set transfer to chunk mode: HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setChunkedStreamingMode(8192); but the result was same.. most images are corrupt. can you please help me? i am almost crying =) fighting with this for a week now.. thank you in advance btw. tried it with emulator via normal network and it works ok... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this grou
Re: [android-developers] Re: Corrupted images when uploading to server via POST
yes a iknow, but if he maybe get an ANR, the images could be corrupted if not fully uploads them. of corse he didn't write anything about he would have an ANR. On 12 February 2011 09:35, Indicator Veritatis wrote: > You are right, it is a bad idea to do it in the UI thread, but his > problem is not the problem one would expect from doing it in a UI > thread. That is, given that his failure takes place in his existing > code, I would expect the same failure to take place once he has moved > it to a worker thread. > > After all, the error we expect due to doing network in the UI thread > is the infamous ANR. But that is not what he is getting. He is getting > missing stuff in the uploaded files. > > On Feb 11, 3:41 pm, Gergely Juhász wrote: >> It is a realy bad idea to make network communication in the ui thread. >> You should always make net io in a worker thread. >> >> On 8 February 2011 15:45, alex c wrote: >> >> > ello. >> > i'm experiencing a problem when uploading images from my android >> > application to remote server (apache with php). >> >> > devices are: htc hd2 and samsung galaxy tab. all with android 2.2 >> >> > the application itself is very simple: >> > public class UploadTest extends Activity { >> > private final static String TAG = "UploadTest"; >> >> > /** Called when the activity is first created. */ >> > @Override >> > public void onCreate(Bundle savedInstanceState) { >> > super.onCreate(savedInstanceState); >> > setContentView(R.layout.main); >> > } >> >> > private void uploadImage() { >> > String imagePath = Environment.getExternalStorageDirectory() >> > + "/Andorra/Images/748.jpg"; >> > String exportUrl = >> > "http://domainname.here/pda/export_photos.php";; >> >> > String responseStr = ""; >> >> > MultipartEntity reqEntity = new >> > MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); >> >> > reqEntity.addPart("image", new FileBody(new >> > File(imagePath), "image/ >> > jpeg")); >> > HttpResponse resp = >> > NetworkUtils.sendHttpRequestMultipart(exportUrl, >> > reqEntity); >> >> > new AlertDialog.Builder(this).setMessage(responseStr) >> > .setTitle("Finished") >> > .setPositiveButton("Ok", new >> > DialogInterface.OnClickListener() { >> > public void onClick(DialogInterface >> > dialog, int whichButton) { >> > } >> > }).show(); >> >> > } >> >> > public void btn1_onClickHandler(View v) { >> > uploadImage(); >> > } >> > } >> >> > so it's as simple as it can be. >> > the problem is that the uploaded image is corrupted. >> > the file size is same. but content can differ. sometimes it uploads >> > ok. sometimes it is broken.. >> > example: >> > original image;http://pixelbirthcloud.com/corrupted_images/1_orig.jpg >> > uplaoded image:http://pixelbirthcloud.com/corrupted_images/1_corrupted.jpg >> >> > the binary diff says: >> > >> >> > 00051330 | 49 69 11 4B 9D E6 | 00051330 | DA BB 10 70 DC 77 | >> > 00051338 | 2D B9 1B B9 E4 81 5A E6 | 00051338 | AC 20 C7 90 7E B4 33 >> > 80 | >> > 00051340 | D4 14 B0 F4 EA 3D D1 E9 | 00051340 | 31 9A B8 C2 29 83 66 >> > 9C | >> > 00051348 | 61 9D E3 38 F7 36 DE 63 | 00051348 | 9A 84 8E 73 9A 8D B5 >> > 29 | >> > 00051350 | 25 9D 9D C4 64 C3 23 AA | 00051350 | 18 60 1C 0F 7A CF 33 >> > 01 | >> > 00051358 | 4A EB 08 C3 97 7C 8C 36 | 00051358 | D4 F0 7A D3 24 BA 85 >> > 71 | >> > 00051360 | 73 F5 E3 15 14 5B BC C1 | 00051360 | F3 0A 76 8A D6 C4 36 >> > 5E | >> > 00051368 | B9 A4 49 06 71 1B 11 87 | 00051368 | 7B B9 5F 20 E3 A5 46 >> > F2 | >> > 00051370 | 39 E7 76 7B 8F 5F | 00051370 | B8 1D 4E 6B 36 6D | >> > >> >> > internet connection is 3g in my case and slow wifi in client's case. >> > for client the images are 90% corrupted (cannot see anything) and it >> > happens like 98% of the time. >> >> > after some time i tried to make the upload using HttpURLConnection >> > class and had same results. >> > then tried to encode files with base64 but even in this case the >> > base64 text is received corrupted. >> >> > also tries to set transfer to chunk mode: >> > HttpURLConnection conn = (HttpURLConnection) url.openConnection(); >> > conn.setChunkedStreamingMode(8192); >> > but the result was same.. most images are corrupt. >> >> > can you please help me? i am almost crying =) fighting with this for a >> > week now.. thank you in advance >> >> > btw. tried it with emulator via normal network and it works ok... >> >> > -- >> > You received this message because you are subscribed to the Google >> >
[android-developers] Re: Corrupted images when uploading to server via POST
You are right, it is a bad idea to do it in the UI thread, but his problem is not the problem one would expect from doing it in a UI thread. That is, given that his failure takes place in his existing code, I would expect the same failure to take place once he has moved it to a worker thread. After all, the error we expect due to doing network in the UI thread is the infamous ANR. But that is not what he is getting. He is getting missing stuff in the uploaded files. On Feb 11, 3:41 pm, Gergely Juhász wrote: > It is a realy bad idea to make network communication in the ui thread. > You should always make net io in a worker thread. > > On 8 February 2011 15:45, alex c wrote: > > > ello. > > i'm experiencing a problem when uploading images from my android > > application to remote server (apache with php). > > > devices are: htc hd2 and samsung galaxy tab. all with android 2.2 > > > the application itself is very simple: > > public class UploadTest extends Activity { > > private final static String TAG = "UploadTest"; > > > /** Called when the activity is first created. */ > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > } > > > private void uploadImage() { > > String imagePath = Environment.getExternalStorageDirectory() > > + "/Andorra/Images/748.jpg"; > > String exportUrl = > > "http://domainname.here/pda/export_photos.php";; > > > String responseStr = ""; > > > MultipartEntity reqEntity = new > > MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); > > > reqEntity.addPart("image", new FileBody(new File(imagePath), > > "image/ > > jpeg")); > > HttpResponse resp = > > NetworkUtils.sendHttpRequestMultipart(exportUrl, > > reqEntity); > > > new AlertDialog.Builder(this).setMessage(responseStr) > > .setTitle("Finished") > > .setPositiveButton("Ok", new > > DialogInterface.OnClickListener() { > > public void onClick(DialogInterface > > dialog, int whichButton) { > > } > > }).show(); > > > } > > > public void btn1_onClickHandler(View v) { > > uploadImage(); > > } > > } > > > so it's as simple as it can be. > > the problem is that the uploaded image is corrupted. > > the file size is same. but content can differ. sometimes it uploads > > ok. sometimes it is broken.. > > example: > > original image;http://pixelbirthcloud.com/corrupted_images/1_orig.jpg > > uplaoded image:http://pixelbirthcloud.com/corrupted_images/1_corrupted.jpg > > > the binary diff says: > > > > > 00051330 | 49 69 11 4B 9D E6 | 00051330 | DA BB 10 70 DC 77 | > > 00051338 | 2D B9 1B B9 E4 81 5A E6 | 00051338 | AC 20 C7 90 7E B4 33 > > 80 | > > 00051340 | D4 14 B0 F4 EA 3D D1 E9 | 00051340 | 31 9A B8 C2 29 83 66 > > 9C | > > 00051348 | 61 9D E3 38 F7 36 DE 63 | 00051348 | 9A 84 8E 73 9A 8D B5 > > 29 | > > 00051350 | 25 9D 9D C4 64 C3 23 AA | 00051350 | 18 60 1C 0F 7A CF 33 > > 01 | > > 00051358 | 4A EB 08 C3 97 7C 8C 36 | 00051358 | D4 F0 7A D3 24 BA 85 > > 71 | > > 00051360 | 73 F5 E3 15 14 5B BC C1 | 00051360 | F3 0A 76 8A D6 C4 36 > > 5E | > > 00051368 | B9 A4 49 06 71 1B 11 87 | 00051368 | 7B B9 5F 20 E3 A5 46 > > F2 | > > 00051370 | 39 E7 76 7B 8F 5F | 00051370 | B8 1D 4E 6B 36 6D | > > > > > internet connection is 3g in my case and slow wifi in client's case. > > for client the images are 90% corrupted (cannot see anything) and it > > happens like 98% of the time. > > > after some time i tried to make the upload using HttpURLConnection > > class and had same results. > > then tried to encode files with base64 but even in this case the > > base64 text is received corrupted. > > > also tries to set transfer to chunk mode: > > HttpURLConnection conn = (HttpURLConnection) url.openConnection(); > > conn.setChunkedStreamingMode(8192); > > but the result was same.. most images are corrupt. > > > can you please help me? i am almost crying =) fighting with this for a > > week now.. thank you in advance > > > btw. tried it with emulator via normal network and it works ok... > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- You received this messag