uploadfolder=request.folder+'static/docs' suddenly aint working as it should, initially is worked. What should happen is that when i save a PDF file it should be save in a static folder called
docs & in a database table but the
docs folder in static doesnt get created now I am getting the
404 NOT FOUND when i try to view or open the PDF. I dont know why this is suddenly happening when it used to work, do i need import some python library or change my code somwhere?
CODE:
model:
db.define_table('pdfs',
Field('Form_Name', label=SPAN('Document Title', _style="font-weight: bold;"), widget=lambda field, value:SQLFORM.widgets.string.widget(field, value, _placeholder="Invoice/PO/Quotation Name")),
Field('status', 'boolean', label=SPAN('Status (For Invoices Only)', _style="font-weight: bold;")),
Field('status_condition', requires=IS_IN_SET(['Quotation', 'Paid', 'Unpaid', 'Cancelled', 'Paid With Balance'], zero=None), label=SPAN('Status Condition', _style="font-weight: bold;")),
Field('fileS','upload',uploadfolder=request.folder+'static/docs', label=SPAN('Upload Files', _style="font-weight: bold;")))
CONTROLLER:
def saveDocument():
form=SQLFORM(db.pdfs)
if form.process().accepted:
response.flash=T('Form Saved')
return locals()
def viewer():
row = db(db.pdfs.id==request.args(0)).select(db.pdfs.fileS).first()
redirect(URL('static','docs',args=row.fileS))
VIEW FOR SAVED DOCUMENT VIEWING
{{extend 'layout.html'}}
{{for details in details2: }}
<div id="formIcon">{{=A(details.Form_Name, _target="_blank", _href=URL('viewer', args=details.id))}} <br />
{{pass}}
</div>
Regards;
Mostwanted