Maybe you are not using a separator (eg '/').  Try something like this:

uploadfolder = os.path.join(request.folder, 'static/docs') 

On Monday, 5 October 2020 at 17:21:43 UTC+1 mostwanted wrote:

> *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 
> <http://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 
> <http://details.id>))}} <br />{{pass}}</div>*
>
> Regards;
>
> Mostwanted
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8c077a8c-a36c-418a-9a8a-713fdd97aedan%40googlegroups.com.

Reply via email to