I'm trying to write a plugin for trac but I'm missing sthg. after reading all the tutorials made by the site trac.
So I'm trying to upload a file to the sever using the POST method this a simplified example :
<form id="MyForm" name="input" action="" method="post">
<label for="attachment">URL :</label>
<input type="file" name="GanttFile" value=""/>
</form>
Now I'm trying to process the uploaded file ,read it and do some modifications than save it or ask the user to choose where he wants to save the file (export some data from the trac database)...I'm still blocked at this level :
def process_request(self, req):
data = {}
if req.method=='POST':
file=req.args.get('GanttFile', 'value')
# and now I'm blocked !! how can I modify this file
# and then redirect or save it !
and if I try to display the content of the variable file I just get the name of the file not all the path ?
By doing something like this :
<input type="text" name="file" value ="$myfile" />
and in my source code :
def process_request(self, req):
data = {}
if req.method=='POST':
file=req.args.get('GanttFile', 'value')
# display the content
data.update({
'myfile': file
})
Any idea or ideas ?
Thanks