ios - Decode base64 converted image on server show corrupt image -


i'm converting image gallery base64, upload 'webservices.asmx'. image corrupt on server, or fault? don't know. tried put string in: 'http://www.freeformatter.com/base64-encoder.html' , decode string , correct image.

my code:

// http post         nsurl *url = [nsurl urlwithstring:@""];         afhttpclient *httpclient = [[afhttpclient alloc] initwithbaseurl:url];         [httpclient setdefaultheader:@"content-type" value:@"application/x-www-form-urlencoded"];         nsdictionary *params = [nsdictionary dictionarywithobjectsandkeys:                                 [nsstring stringwithformat:@"%d", userid], @"userid",                                 self.imagebase64, @"file",                                 nil];           [httpclient postpath:@"http://www....../webservices.asmx/saveimageios" parameters:params success:^(afhttprequestoperation *operation, id responseobject) {              nsstring *responsestring = [[nsstring alloc] initwithdata:responseobject encoding:nsutf8stringencoding];             nslog(@"\nresponse xml: \n%@", responsestring);          } failure:^(afhttprequestoperation *operation, nserror *error) {             nslog(@"error: %@", error.localizeddescription);         }]; 

sample base64 string(converted image):

/9j/4aaqskzjrgabaqaaaqabaad/4qbyrxhpzgaatu0akgaaaagaagesaamaaaabaaeaaidpaaqaaaabaaaajgaaaaaaa6abaamaaaabaaeaakacaaqaaaabaaabqkadaaqaaaabaaabcaaaaad/2wbdaayebqyfbaygbqyhbwyichakcgkjchqodwwqfxqygbcufhyahsufghsjhbywicwgiyynksopgr8tmc0omcuoksj/2wbdaqchbwoichmkchmoghyakcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcgokcj/waarcaeiauadasiaahebaxeb/8qahwaaaqubaqebaqeaaaaaaaaaaaecawqfbgcicqol/8qatraaagedawieawufbaqaaaf9aqidaaqrbrihmuege1fhbyjxfdkbkaeii0kxwrvs0fakm2jyggkkfhcygroljicokso0nty3odk6q0rfrkdisuptvfvwv1hzwmnkzwznaglqc3r1dnd4exqdhiwgh4ijipktljwwl5izmqkjpkwmp6ipqrkztlw2t7i5usldxmxgx8jjytlt1nxw19jz2uhi4+tl5ufo6erx8vp09fb3+pn6/8qahweaawebaqebaqebaqaaaaaaaaecawqfbgcicqol/8qatreaagecbaqdbacfbaqaaqj3aaecaxeebsexbhjbuqdhcrmimoeifekrobhbcsmzuvavynlrchyknoel8rcygromjygpkju2nzg5okneruzhselku1rvvldywvpjzgvmz2hpann0dxz3ehl6gooehyahiimkkpoulzaxmjmaoqokpaanqkmqsro0tba3ulm6wspexcbhymnk0tpu1dbx2nna4upk5ebn6onq8vp09fb3+pn6/9oadambaairaxeapwd6pooooakkkkaciiigaooooakkkkaciiigaooooakkkkaciiigaooo6uafboyopekldn1fackzfiwymvg8qxatkwvfeuj174lalytpbwcpvr1tgwrgqr+jgkao5pk8yjfjn5lwm7ucrxl0vjlxldfmtdmjsylxj8/df+gtt/hl4y1dxlqguw2opcxs2ukylkr95h0j9qaptqgrva6dkkhsmg5a7jrmndkuaffffabrrrqauuuuaffffabrrrqauuuuaffffabrrrqauuuuaffffabrrrqauuuuaffffabrrrqauuuuafb6hnju5ipgo9iwh6uanjwpjha6yrf8t+jnp0czmt5idkeehu5zm7cdfsofgniedw1ost3kpknj2wwl96q5ha5hbn8k8qt4rnvrxdt15hjcn/vrjjro3ioeebjfafnvlzwfgezf2nklxsm5wzgmyjtlsbl4p6vf0uyttojvlolylharisr+fnsjcdqfec/3sc1jiy2i+dpl1ucf+saaof8ahmspp+lywyyhrqrsngohb5qr+zshxutali4lcan1il5rkvfu0mo3b3lqfx7qjub716r8b7d7ppusp6yymmnrwtqb7kobj8kcolnip65pwoakkkkaciiigaooooakkkkaciiigaooooakkkkaciiigaooooakkkkaciiigaooooakkkkaciiigaooooaarkbwpwqmp30en2dxdxjcqqozssewgatmcnuonoryp45axj5vloce21rmvfmapjjoq2fzoa5qw/m8xejz9wuwvs4gmvonyge4ft1u966gegbbugp7vvwpphgsbs3gdovhukmhqamc1qq6jeqgqdce27tqbralbhunix2rmtyunvzpkztixoauxjkno6zib2anywrtcgb/mwp1oa5zwgzrmc1ggxmckqo2ek93+h2mfynjto9ucegfrivk/h9osup6r/acyhypg0y46g17vpkqiguay+taghrr0ooakkkkaciiigaooooakkkkaciiigaooooakkkkaciiigaooooakkkkaciiigaoopsmlvot6uaoopobiyqwpqsent3oawim7wtgc/slzj3oawimbjnkmp5uutjn/wadoajudinwenwvlv4l6ljqfxfvxvji2xeg9avu19pxzbbat7/ir5quum/izuzsglgvc+og0uabxh2zlkbdk7eh1ndvzw0cmxzdnrwdpuqqxrkha/vvpfa9eh8ueezkeijmgdq1g7jgqux4hsubsbg517vb1fup/p8azirmnapea7dhrwsrw54judfzr1xw34eis41croguelafrwtokdlzrhgaohok6huaaa7dfrxxbqaur9al9u9ac0u1iqoqt9km8drqa6imbwomw+loboawiiigaooooakkkkaciiigaooooakkkkaciiigaooooakkkax6+o6uaooqemw5pd9lncb8r/izpvhghyfp2rvjoeghw5zx1g4hukao+vlmg1t3lujfrfgsscv5r4q+mxh/rgmnoxv7rtfgrl/49txxllxd4k8bxh2jxlevdp7folipixhyeez6ejrxrarognaveba2ybvpqbkpip4u1yn+y9bfleejsypj/hva41px9dnzdqlpaz5wbcn/jq2l3bckkppthqbgeeomab/hkbli/hfirn/x6pynz8facd/2i2vqpsnuz+bvt0uaurx4x6vpvwe8teh3shvcxzkqf+aqcfsvsvc/jzq/eckywn4u4/8alngvi/mcuacruprlznqcodwdqng7tl1zlbrc2ud/amte4oa97vw8y2o1wq44wm188694h1jpemoxvtibdm4xx0+ud19qm0+78b+fz5npfrqdr/clwzhavydab/kvqnx7rdrsn0ankopjhcj+dagdzedbx0utxhz6bt/jxrwug6bpef2i9lxk/watn0/cufu/epi/uh5wn2kgmoesrk6n/uvvi8gm6ct6/fs38vowbh8hqb0f78tne0n9zplu+q3w4ecymqh4lcvepib4w1cmnaaqlmp7pijnhb0qxp+m2gnrhbaalj2q6x4golagdje+plk7jqdrag+sab+tvhu8day/4skzb/tzx/7nw+ttsaamadxvhumnilt7z/tmq/znsxfgxxdiki8qegjgibwz47hqprtajrry1fltiw67lpxigdtfcfxl8pejuh2s8wou9ynrli/egv26mrafscd0infn+uee9j1i7zdtm6hhxg9jvbsffnir4esd7fi+samd8q4ltevtjaog/wgd6cormvcpimw8uaxfeadng7omtgwg9fyge46guionuamjukah0u1ab04hptqaciiigaooooakkkkaciiigaooooakkkkacmshg4446+loy4fcb8s/fshhhw7pefl+1saxwx5gwc8kcegokaob+l3xb/sg2xtnhxnrmqjzjjhx1goo9a818o+hts/9qay5utufktp84huca5xxj8qo+e9punq1g51/v2l31y7sbtxtdenx+jndkp5oaskkqacmdnpzsqcdnjp41gpqvtqbkoeefzpwnmu0uaajm0uwglzqa7gj5mbhobz+daiu8dpq80yigcvwvw3yyt/vcd8kqe7tzeen+6nukbmjnaeoyjoxz/tcikjjpt5vucd8qzufg4uapbjhagcdmmbhruoacttsaawppagay1gzyz3pwaoxagbpbb+8ofaopcsilz0wvmywwyv4jvq5zxnhvvhub63syvmupbgidj5gzppmgdk9vku/awtrapomsgsqkyw4fcnxjgdbjctx0r4a8y2fi7rvursqefhxkudwcz9b6ivlpxnvuvempi3s4xdscrhvj/ph0r3l4jeb28nlldxc5a9myso6y+x/aaoa9ntn5vuu6mr5zk+g4p9abrrrqauuuuaffffabrrrqauuuuafbokkrv160aryufblcadoa+xfifrx/cb+put0zjp1gw2rnhshssr6gg17l8v9fhh3wfe3hyebtcxj1oqp6188/dztzz6fjpkd0k+tn8tqb2kclcipgbsvdox6e9wfpnvyvl8teuetvhtzqbzwpf61epp6mgcyu6o1nozqa6jnnzrmgb+am0zngaah7qn1mzrmgb9fm3uzoafmkztc0zoaummk45pa9aqmmmwu5jz7uabbj45hruluc23vud5drwjvndut0zxi654mkxpfarlsfv8apqbsa1regnoqszjmfdhavndqvl/x9rsgel5gicit8qjpbiz71bfznlzpiswofpqfsvyfg74lnvb/anpxih7q/wayggjc8ggdu+gngcdrrdlh1sa7lgwerqwhx7vcda9f06wscnag4hotyfzo0+1skngh3ew9pwthtxqaayjpab0ooakkkkaciiigaooooakkkkaciiigapgwasawms/cp0oa8h/av1i+vpomxtnzjszqe4xx/kuc0mew1pfevrr3+tn+nm/2/wcjttbn5ibddj3y4qdd89af6e81pgeapxnzvqi0awlnskagbqrtqbmds7jtaam0asbqxnrg0uaah5oztm0zoafupm03fgdqavnogpwmgjhzmkrzxmeyyz59qalxpqkawx1fzdxq8uy+qzrlunznkyixthegdoj7ygfsxccstufecx5+z7wpqrmssd3ly0je+1u3ahau4oajvrue8ytpi+3+7nisqbidbcedchpv2uluolupcrhyx46uaxfb2idx/edteyloijvcdsqqrx1dofjffaovaoxoamcvfv2ftjhkxl+/pmmox9rxv9ugjtaoaeqae+h7dht6brqauuuuaffffabrrrqauuuuaffffabrrrqavfcname1s1xvf9saaplxxstn8uj2jzhcfhuetoek85rj8vkj4nxa9j/6e1asfafyhoavr8vutxk1fjx14+taeqlkviqn0qfplj7jj3qj73+7qbect6ckjc/eirlkupxgm1a29+rggdya4ht7zve17co9zqiprmnewpsgc6+pidhrmozqfolvsi56uex6cgc02qsecrqpwqs99ct7a0nlr3p6ugmy4naemskz/wdlrsfwogqt97k+9xvxa6uhj5zigcgyvamohgk0th7uxos0aztx46cqsq1tsq8vumh9qamk4tjpzwzflmbvwuhuieolzf/difikapdvgvahpb1o2bywz7/o1esyhpxmpwlyp4ls8ey+f/0nq9ooakkkkaciiigaooooakkkkaciiigaooooakkkkacq9+m25qxun3nym9mc0afk3jkcd4mtdsxa/wdjz1pwo4a/oq/xdtzbfevzqmk9smd6nc9hnhf+u/maanuspbyd81maewt7x4rphzi25jwjeg45oaftpj61iqviq9mcpvx2oaicuuyrawl20avtlg2rbwjbqbx2ubksbaxbqbw2ubks7antafbzsbktbatbqbvku0xmrzsjzqbrepiqzx81punpudx89kams6iny+ojtxar1rp7ippasm+j3sbsoccuaekfs83obrbztuhs3xa/3ixr2ygvmb4wayuielhsvtknzhw7/n0h86+lq6k8hvj8aajakqhnhps0affffabrrrqauuuuaffffabrrrqauuuuafr3aze30qsmum8fjqb88/h212appl6g/wbhj9af8a4+1lmhga9w+o2nmbw1loigvc2r+yferay4zgr0oa6gzxobwlgnnz9n1fa0yzqbiicviqu5b0qzuoajcuvl1oexs7aak/l0exvnzrsoarexr5dwdlgygct5dhl1z2ubkak3l0exvnzrsoarexsgorwykzkaktr1e6c1ezkjepmgdmmjz2rpu4jso3lu1brxg1unguksv3jqbxepw21kmjys0bbxj25r6d+fvilpeoirea6c/hui6e/mqaoczz1nelxlvu6ae/sqgl6rfef9xjv7isqpamjdybuhjh6uafwwrj3nlxoedve1p4m0xbm0b5wbujocqfr36guhyqobmgb1firakjuoopaaciiigaooooakkkkaciiigaooooaka45z7yp1irnge3nahk+n7ax+ktqmuqy18w6wklnkbayesitkfjmvr3u4w9s2rmvmt4i6f/zhizzqu2k6+79qfh86alwnt0zw1coa53tpn8ygfnx71dfbhokalil0qdfpqdpvhvoatbxshklc04lqbfso21pto20aqbantt7antaeg2jbu+2jbqbbto21pto20aqbaqpmrg2jbqbvkuxo6ubpakmy9kam54qryq5zwm6cope44oawbi2zmso+trwdymc+9dblhnpfzv3ecwbawaaot0ru9s8naql3s5dfsperhd5bb6j3ne6+b/ixpnionla6kfle5wukixd06zpvxi+pwjaebkddxp3mplopiz45wd3mi2cb9aapsuegj5cpxgqqakryn4c3+r3mgtvq05mhvzhcw5baj6nvxivvqc0alrrrqauuuuaffffabrrrqauuuuafheiigcord6kv5p8aghqrfax5qr+8t8yifycn+veuvi+ibflu3kwqzuowwfpqb8xahoji8z+fdhq6+ybkvy/idtd4e8utrayguglr6lljx+lbwmzdio4mgdp4rkcrklzvo0cmo5q/gkahqtsbafgkkuuam2+1g2pgkcb7uav9tg2pyvng2gcdbrtqbhtrj2oah20banxrtoag20ban20baaintiuqcrtwfafv15qjxxvphtgx2oaosikyrxagnbuoazwlfdsw6uac9qebnpsuzurldxuvrep300ojx6hit7v5c7uwfapwx0uaprx2+czs3yfaeeqvoaapzfh3pz0rqba27baw/wb4jmu1awmvs0qerw4ahbgavuaaooooakkkkaciiigaooooakkkkaciiigaqg5xzaepq81nsmm5fahk/wavfdz1swlkt1xnesyn16/415lol5h/lkyrkcypffugrwkz25ffpnxc8ovpgqjubjf9fy/mo7caf40aa2m3cnarcgfptmug0e/rlg07lbvxv6fcgrqbskc1ioqcjw1wugrqaofoaoiwauualijffitqa0jnprj2paxmgbmuac0vnfac4oxsg0e0anipjcnk008mgcjhubgavm5fu7mqauav7kga8iubv5tobngda1l26azxh61qcgofomagj+9qbl34l1g7wytsmsu8y9utxv8a8ptbxtbggjl5qfmfxpxnfwx8mnlkuo3ifvtzdnt1b7ele66fbetaooatrltxhbpfpoooakkkkaciiigaooooakkkkaciiigaooooakpwiigbpumpbrlffojpd29wgqesrgr/ahemv1lqzrlngekaplxubcbw1qtwrkfszszv/wace/pxq6xfaicsmv6r438mr6lbzlsadgqgx0pppsvepkudd1h7ndbhh/c56uaej2d0rd8vpwzljrxe6bqiyn7hsjg5rdt71wawaaohb3dkd0riw6wb81p+2dh3qanmkeopjob3rjkvkapzc1tk1pb60ab5lx6fnsgccuxk1vbnzgcvxbw0b+sr8fwgdsbodsiyz5ncgutre/ni2fqksjqa4busfrqb1gceto6jgiuei1afrk1zs/ujhqany0xjiqh2sf3v1pjxozy1afiazv6msy+u1xggonqvla4aub1tu9qli2ymdeczoaxv79y925u3bmofb+hteittjuj4yttgqvj/i5h09aq6hpvx4jvvkqy26sdupap86948l6dfzwlhfgf29eppqbq+htns3tlatg0aaelb44fmjukovrgcn0affffabrrrqauuuuaffffabrrrqauuuuaffffabrrrqauywokkkak93blpgvyzbht1rzvxl4uh1g3dxjboplpcv6wagngsvcd1oa+vr3t7vqj2jmdpdnhvsrflqyyywniwhy8v7nrvhxltgbiegpugvodb+hlu8rpa7ope+p8a9vagj/a2wap949bmmy6qvtctgfwnl4gvlfb50gu9sp8a9vxbt4e5lbnlujfbj/cgdnn1tpgihvnb0qe0sdx1nvktyge+qa9m0xwtbayio2ix/ehndhzabhdgmno9qaphbtwtpjj7to7nuon9a14valuf5icn13n/abr2kls4uanwbarayxqb4jp4dgio1hu+u8/41i3vhc9tstazssoikf8a16+hjzrmervs50inwdogtqb823t6pprxfqkrj+jwdfokw211h+6x465gk9z1dw1g4yxryj6lxxxf6t4dsp2lsqfvf7ycgdjl1kmmdjph1msmkct6zq3p4cuiyfjnu0x0bah8qrx+a7ur9rzlh3ap/wbagdfv9uwdusw9bzv7w14cutcnet3kw/uj6iu38oearw0cmkbm3q4r0frteeckgukqo1agb4w8orwkcki1smdab/wuzjieagjgh1xrhgqiffsuahphnfffabrrrqauuuuaffffabrrrqbv/tgy/wcfy2/7+r/jr/anl/z+w3/f1f8agiiga/tgy/5/lb/v6v8ajr/anl/z+w3/ah9x/giiga/tgy/5/lb/al+r/jr/anl/z+w3/f1f8akkad+0bl/n8tv+/q/40f2jzf8ap5bf9/v/xoooap7rsv8an8tv+/q/40f2jzf8/lt/39x/aboooap7qsv+fy2/7+r/ai0n2+xzn7xbf9/v/waakkaea+swh/h5bf8af1f8artsac/w5tf+/i/40uuavhhputi5tf8av6v+nsrrpyniu7uh/rov+nffafuk6se5+122fxzv/waal/tcx/5+7b/v4v8ajrrqaf2hzf8ap5bf9/v/xo/tcx/5+7b/al+r/jrrqaf2hzf8/lt/39x/abo/tcy/5/lb/v6v+nffacnf2ldbu7y/9tv/xqks409wp9ktf+/i/wcnffafordoc5n1bh/tqv8ajtvj00hp2i1h/brf8akkalcm2nxdlq1/7+l/ai1yf/y4h+l23/f1f8akkaf/tcy/5+7b/v6v+nh9o2x/ad+w3/f1f8akkad+0bl/aj/lb/v6v+nh9o2x/p5bf9/v/waakkad+0bl/n8tv+/q/wcnh9o2x/p5bf8af1f8akkad+0bl/n8tv8av6v+nh9o2x/p5bf9/v/xoooap7rsv+fy2/7+r/jr/anl/wa/lt/39x/giiga/tgy/wcfy2/7+r/jr/anl/z+w3/f1f8agiigd//z

edit: problem server side, fixed now, code pretty fine (even when duplicated userid, removed). :)


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -