This is the code what i use to save the file.
tmpData = str(rawData)[1:].strip("' '")
tmp = tmpData.split('\\r')
for piece in tmp:
for slice in piece.split('\n'):
if 'Content-Disposition' in slice:
filename = slice.split(';')[2].split('=')[1]
h = open('home/hidura/'+filename.strip('" "'), 'wb')
elif '\\x' in slice:
pickle.dump(slice, h)
h.close()
On Oct 2, 2010 10:37am, hid...@gmail.com wrote:
The results was that, i can upload all the data normally comes as an byte
code and looks like this:
\\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\\...@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
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
Thanks for the answer!!!!
On Oct 2, 2010 5:34am, "Diez B. Roggisch" de...@web.de> wrote:
> Chris Rebert c...@rebertia.com> writes:
>
>
>
> > On Fri, Oct 1, 2010 at 11:13 PM, hid...@gmail.com> wrote:
>
> >> Hello, i control the problem of the data what is uploaded by the POST
>
> >> method, in the web if the file is a text theres no problem
>
> >> but the trouble comes when it's an enconded file as a Picture or
other what
>
> >> the when the system insert the data into the file
>
> >> well it doesn 't encoded in the write way i will put all the code,
from the
>
> >> area whats take the environ['wsgi.input'] to the area
>
> >> thats save the file:
>
> >>
>
> >> tmpData = str(rawData)[1:].strip("' '")#Here the data from the
>
> >> environ['wsgi.input'], first i convert the byte into a string delete
the
>
> >> first field that represent the b and after i strip the single quotes
>
> >> dat = tmpData.split('\\r')#Then i split all the data in the '\\r'
>
> >> s = open('/home/hidura/test.png', 'w')#I open the test.png file.
>
> >
>
> >> Where is the mistake?
>
>
>
> In believing that wsgi.input is a simple file that contains your
>
> upload. It isn't. It is multipart/form-data encoded, to cope with
>
> potentially many files being uploaded in one go, plus assorted other
>
> form fields.
>
>
>
> In another post, you have already been shown how to do this. What where
>
> the results? How does your full script look like? How does the form look
>
> like you upload with?
>
>
>
> Diez
>
> --
>
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list