This is the code what i use to save the file.<br />tmpData = str(rawData)[1:].strip("' '")<br />tmp = tmpData.split('\\r')<br />for piece in tmp:<br />      for slice in piece.split('\n'):<br />          if 'Content-Disposition' in slice:<br />               filename = slice.split(';')[2].split('=')[1]<br />               h = open('home/hidura/'+filename.strip('" "'), 'wb')<br />           elif '\\x' in slice:<br />               pickle.dump(slice, h)<br />h.close()<br /><br /><br /><br />On Oct 2, 2010 10:37am, hidura@gmail.com wrote:<br />> The results was that, i can upload all the data normally comes as an byte code and looks like this:<br />> <br />> \\n\\x1a\\n\\x00\\x00\\x00IHDR\\x00\\x00\\x05U\\x00\\x00\\x026\\x08\\x06\\x00\\x00\\x00P]h\\xc5\\x00\\x00\\x00\\x01sRGB\\x00\\xae\\xce\\x1c\\xe9\\x00\\x00\\x00\\x06bKGD\\x00\\xff\\x00\\xff\\x00\\xff\\xa0\\xbd\\xa7\\x93\\x00\\x00\\x00\\tpHYs\\x00\\x00\\x0b\\x13\\x00\\x00\\x0b\\x13\\x01\\x00\\x9a\\x9c\\x18\\x00\\x00\\x00\\x07tIME\\x07\\xda\\n\\x01\\x148\\x04\\x86\\xa0\\x99c\\x00\\x00\\x00\\x19tEXtComment\\x00Created with GIMPW\\x81\\x0e\\x17\\x00\\x00 \\x00IDATx\\xda\\xec\\xddw\\x9cT\\xd5\\xf9\\xf8\\xf1\\xcf\\xbd\\xd3g{_v\\x97\\xde\\x9b]\\xb0!\\x8a\\x05\\x14\\xbbFE\\xe37\\xc6\\xfaK\\x8c\\x9a\\x18\\x13\\x13c\\x8b\\x1a\\x13Mb\\x8a\\xb1D,\\xb1\\x1b\\x0b\\x8aDbE\\xac\\x18D\\x94*(}Y\\xb6\\xf7\\xd9\\xa9\\xf7\\x9e\\xf3\\xfbcf+\\xdb\\xc0U\\x97\\xe5y\\xbf^\\xe3\\xee\\xce\\xbd\\xa7\\xdcs\\xcf\\x1d\\x9d\\xc7S\\x0c\\x80\\xf7\\xbf\\xaa\\xd4e\\xf5ab\\xb6F\\x08\\xf1\\xdds9\\x0c\\xf2R\\xbd\\xec78\\x9d\\x14\\xafS\\x1aD\\x08!\\x84\\x10B\\x88\\x01\\xe0\\x99\\xa5\\xc5\\xd2\\x08B\\xf43J\\xd9h\\xa5@k\\xbe\\x89\\xa8\\x98\\x01`\\x18\\x18\\xa6\\x89i:\\xa4\\xc1\\x07\\x10\\'@f\\x92\\x9b\\xfd\\x06\\xa7\\xe1s\\xc9\\xcd\\x15\\xa2?\\x08\\xc5l\\xb6V\\x87x\\xeb\\x8b\\nfN\\xcc\\xc3\\xef\\x96gS\\x08!\\x84\\x10B\\x08!\\x84\\xe8K\\xca\\x8a\\xa1\\xeb\\xb7\\xa3\\xcb\\xd7\\xa0C\\xb5\\xa0\\x15\\x00\\xee\\xa4\\x0c\\xb0c}S\\x88a\\x827<br />> <br />> and this is what i store in the file, and the part of the code what handle the wsgi it's that what i post, i am using to test the upload file area, i hope this is what you want<br />> <br />> <br />> Thanks for the answer!!!!<br />> On Oct 2, 2010 5:34am, "Diez B. Roggisch" deets@web.de> wrote:<br />> > Chris Rebert clp2@rebertia.com> writes:<br />> > <br />> > <br />> > <br />> > > On Fri, Oct 1, 2010 at 11:13 PM,  hidura@gmail.com> wrote:<br />> > <br />> > >> Hello, i control the problem of the data what is uploaded by the POST<br />> > <br />> > >> method, in the web if the file is a text theres no problem<br />> > <br />> > >> but the trouble comes when it's an enconded file as a Picture or other what<br />> > <br />> > >> the when the system insert the data into the file<br />> > <br />> > >> well it doesn 't encoded in the write way i will put all the code, from the<br />> > <br />> > >> area whats take the environ['wsgi.input'] to the area<br />> > <br />> > >> thats save the file:<br />> > <br />> > >><br />> > <br />> > >> tmpData = str(rawData)[1:].strip("' '")#Here the data from the<br />> > <br />> > >> environ['wsgi.input'], first i convert the byte into a string delete the<br />> > <br />> > >> first field that represent the b and after i strip the single quotes<br />> > <br />> > >> dat = tmpData.split('\\r')#Then i split all the data in the '\\r'<br />> > <br />> > >> s = open('/home/hidura/test.png', 'w')#I open the test.png file.<br />> > <br />> > > <br />> > <br />> > >> Where is the mistake?<br />> > <br />> > <br />> > <br />> > In believing that wsgi.input is a simple file that contains your<br />> > <br />> > upload. It isn't. It is multipart/form-data encoded, to cope with<br />> > <br />> > potentially many files being uploaded in one go, plus assorted other<br />> > <br />> > form fields.<br />> > <br />> > <br />> > <br />> > In another post, you have already been shown how to do this. What where<br />> > <br />> > the results? How does your full script look like? How does the form look<br />> > <br />> > like you upload with?<br />> > <br />> > <br />> > <br />> > Diez<br />> > <br />> > --<br />> > <br />> > http://mail.python.org/mailman/listinfo/python-list<br />> >