:-) I was having a hell of a time trying to get all the AJAX examples to work and well, none of it f***ing would. Yesterday I brewed an extra strong pot of coffee and cranked this out.
Some of the code i would like review on, I am not sure how to properly check for if there was an uploaded file or not, i have that weird "is in" then "len() < 0" but i don't think it's the best. Whoever is a maintainer/developer of web2py - could we integrate this somehow? Calvin On 8 January 2014 10:40, Brando <bhe...@trustcc.com> wrote: > Calvin, you are awesome. I will try this on my end and report back. > > > > > > On Wednesday, January 8, 2014 7:18:28 AM UTC-8, Calvin Morrison wrote: > >> I just wrote my own way to do it yesterday which worked great. I would >> love it to go upstream. >> >> It's just a standard file upload with the multiple attribute. >> >> here's the entire thing: it spits out a form. >> >> my db looks like this: >> >> db.define_table('uploads', >> Field('username', 'string'), >> Field('filename', represent = lambda x, row: "None" if x == None else >> x[:45]), >> Field('up_file', 'upload', uploadseparate=True, >> requires=IS_NOT_EMPTY()), >> Field('up_date', 'datetime'), >> Field('up_size', 'integer', represent= lambda x, row: >> quikr_utils.sizeof_fmt(x) ), >> Field('notes', 'text')) >> >> >> my contorller >> >> def submit(): >> import datetime >> >> form = FORM(LABEL("File(s):"), INPUT(_name='up_files', _type='file', >> _multiple=''), BR(), LABEL("Notes:"), TEXTAREA(_name='notes'), >> BR(),INPUT(_type='submit')) >> >> if form.accepts(request.vars, formname="form"): >> >> if hasattr(request.vars, 'up_files'): >> if len(request.vars.up_files) > 0: >> >> files = request.vars['up_files'] >> if not isinstance(files, list): >> files = [files] >> >> for f in files: >> print f.filename >> up_file = db.uploads.up_file.store(f, f.filename) >> i = db.uploads.insert(notes=request.vars.notes, >> up_file=up_file,filename=f.filename, username = auth.user.email, >> up_date= datetime.datetime.now()) >> db.commit() >> >> redirect(URL('data', 'index')) >> else: >> form.errors.up_files = "No files selected" >> >> return dict(form=form) >> >> >> On 8 January 2014 10:14, Brando <bhe...@trustcc.com> wrote: >> >>> I'm trying to use >>> jQuery-File-Upload<http://blueimp.github.io/jQuery-File-Upload/>to >>> implement multiple file uploads. I'm using this >>> tutorial<http://in10min.blogspot.com/2013/04/web2py-implement-multiple-files-upload.html> >>> as >>> well as this sample app >>> HERE<https://bitbucket.org/xavrenard/multiupload_module/src>. >>> >>> >>> Is there something in the standard web2py build that would be preventing >>> the proper javascript or CSS from running? The sample app should work >>> right out of the box; however, no buttons are displayed. >>> >>> Has anyone successfully implemented this on web2py before? >>> >>> >>> >>> >>> >>> -- >>> 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+un...@googlegroups.com. >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- > 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/groups/opt_out. > -- 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/groups/opt_out.