I am trying to post file from python to php using HTTP POST method. I tried
mechanize but not able to pass the file object.

from mechanize import Browser
br=Browser()
response=br.open("http://localhost/test.php";)
br.select_form('form1')
br['uploadedfile']=open("C:/Documents and
Settings/user/Desktop/Today/newurl-ideas.txt")
response=br.submit()
print response.read()

But, i get the error:
    br['uploadedfile']=open("C:/Documents and
Settings/user/Desktop/Today/newurl
-ideas.txt")
  File
"C:\Python25\lib\site-packages\clientform-0.2.9-py2.5.egg\ClientForm.py",
 line 2880, in __setitem__
ValueError: value attribute is readonly

But,
When uploading is done using browser, it works.
-- 
Yours,
S.Selvam
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to