|
From: Ian B. <ia...@co...> - 2002-05-20 19:06:43
|
On Mon, 2002-05-20 at 13:48, Ernesto Revilla wrote: > Dear All > > I'm trying to send a file to Webwares FileUpload.py in the examples. But I'm > not able to make this work. I tried to capture what the browser sends to the > server. I need this for some automation tasks. > I'm using Apache 1.3.23 and Webware7b1 > > Suppose I have c:/web.txt... > -----------------------------7d21b62f5011e > Content-Disposition: form-data; name="filename"; filename="C:\kk.txt" > Content-Type: text/plain > > Only testing > -----------------------------7d21b62f5011e > Content-Disposition: form-data; name="_action_" > > fileupload > -----------------------------7d21b62f5011e-- > > ...so my upload code is something like: > > # send form with file data test > file='c:/web.txt' > f=open(file) > boundary=f.readline()[:-1] # read the boundary > data="%s\n%s" % (boundary, f.read()) #all data I'm not clear what you are doing with the boundary here. Data should look like: --%(boundary)s Content-disposition: form-data; name="filename"; filename="%(filename)s" Content-type: %(mimeType)s %(data)s --%(boundary)s-- |