Salve a tutti,
vorrei sapere se è possibile avere un feedback di fine esecuzione
istruzioni della funzione richiamata in default.py.
Mi spiego meglio. Ho creato tutta una serie di pagine html in cui, per
esempio, ho necessità di salvare degli allegati in un database creato in
mysql.
All'interno della pagina ho queste istruzioni:
<table>
<tr>
<td>
<h4> Allega Nuovo File:
<td>
<input type="file" name="mioFile"
onchange="this.form.pathCompleto.value=this.value.substr(12);">
<input type="text" name="pathCompleto" id="pathCompleto">
<td>
<INPUT type="button" value="Salva"
onclick="ControllaNuovoFile();
ajax('{{=URL('AllegaNuovoFile')}}',['txtIdCarico','pathCompleto'],'target')"/>
<td>
</tr>
</table>
Che richimano la funzione AllegaNuovoFile presente in default.py:
def AllegaNuovoFile():
directory = "C:\Upload\\"
nomefile = request.vars.pathCompleto
riferimentoIdCarico= request.vars.txtIdCarico
if (nomefile <> '') :
filepercorso = directory + nomefile
stream = open(filepercorso,'rb')
db.tabella_files.insert(nome_file=nomefile,dati_file=db.tabella_files.dati_file.store(stream,filepercorso),
riferimento_id=riferimentoIdCarico,riferimento_tabella="Carico")
db.commit()
return dict()
C' è un modo per avere un feedback da default.py per avere certezza di
esecuzione funzione?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.