Hi,
I'm building an app to fill "PurchaseRequest", to valid it by the staff, 
and then type a "PurchaseOrder". Exactly like with a paper form that we 
fill, and get signatures to valid it.
Now the main boby of the app works (fill the form, set/choose the route, 
send emails to the concerned persons (by request to the Active Directory), 
....

Now I need for this app, to input one or more (or none) attached file 
(quotation in PDF format, Excel file, technical data in PDF format)...
I can upload this files, sort them, display the titles, ...
Impossible to show the file.
I see the file in the OS directories (<app>/upload/<file>, where <file> is 
TPJ.Document.<.....>.extension).
I have a customised html page, but either I get "unknown page", or I get 
... nothing. When I manually copy the link into explorer, I see the file 
....

The model (only the table for attached) :
dbW.define_table('TPJ',
    Field('NumDA',type='integer'),
    Field('Document',type='upload',uploadfield=True,uploadfolder=os.path.
join(request.folder,'uploads')),
    Field('Titre'),
    rname='WFDA_DA_PJ',
    migrate=False)



The controlleur for filling in is only a test fonction :
def saisie_pj():
    form1 = SQLFORM(dbW.TPJ)
    if form1.process().accepted:
        response.flash = 'Votre PJ a été enregistrée'
    return dict(form1=form1)



The display (and Iif possible showing the files):
It is nested in the main form (and this form is now quite long)
.....
    form = SQLFORM(dbW.WFDA_DemAchat, DA, formstyle ='bootstrap3_inline', 
buttons=LBoutons)
    PiecesJointes = dbW(dbW.TPJ.NumDA==NumDA).select(dbW.TPJ.Titre, dbW.TPJ.
Document)
.....



And now the html view..
<table><tr><td>
{{=form.custom.begin}}
<table border:5px;>
    <tr><td colspan=5 align=center>
        <h1>DEMANDE D'ACHAT    : {{=form.custom.dspval.id}}</h1>
    </td></tr>
......
</table>
{{=form.custom.submit}}
{{=form.custom.end}}
</td>

<td>
<table><tr><td align=center><h2>Pièces jointes :</h2><br>
    <ul>
    {{for ligne in PiecesJointes:}}
         <li>Avec A : {{=A(ligne.Titre, 
_href=URL('upload',ligne.Document))}}<br>
         Avec file:<a href=
"file:\\{{=os.path.join(request.folder,'uploads',ligne.Document)}}">
{{=ligne.Titre}}</a>
         </li>
         {{pass}}
    </ul>
    </td></tr>
</table>
</td></tr></table>



With the "=A(ligne.Titre...", I see the link 
"http://127.0.0.1/da/upload/TPJ.Document.blabla.pdf. When I click I get 
"404 unknown page"
With the "<a href=file:\\...", I see the link 
"file:///C:/Users/..../da/upload/TPJ.Document.blabla.pdf. When I click, 
nothing arrive. When I copy manually the link, and paste into browser 
addrress, my pdf file opens.
I must have written something wrong... or I absolutly don't understand the 
upload/download.

Thank you for all informations :)

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to