views:

14

answers:

0

Hello, i am trying to upload files to a web server using Python 3 but i can 't use a web framework because none uses python 3 so i' ve decide to make by my self just using the wsgiref lib all the process to handle with the upload information in the form, everything is ok when i upload the data coming from the fields but when i try to upload files i cant save it in the respective encode, here is the code:

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()

Thanks in advance.

related questions