Advertisement
Guest User

Arun.K.R

a guest
Jan 6th, 2011
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. def myform():
  2.     response.files.append(URL(r=request, c='static', f='uploadify/uploadify.css'))
  3.     response.files.append(URL(r=request, c='static', f='uploadify/swfobject.js'))
  4.     response.files.append(URL(r=request, c='static', f='uploadify/jquery.uploadify.v2.1.4.min.js'))    
  5.     form = SQLFORM(db.image)    
  6.    
  7.     if request.post_vars:
  8.         c=request.post_vars.Filedata        
  9.         db.image.insert(file = db.image.file.store(c.file, c.filename))
  10.                
  11.     script= """
  12.            $(document).ready(function() {
  13.                $('#image_file').uploadify({
  14.                'uploader'  : '%(uploader)s',
  15.                'script'    : '%(url)s',
  16.                'cancelImg' : '%(cancelImg)s',
  17.                auto:true
  18.                });
  19.            });
  20.            """
  21.     uploader = URL(r=request, c='static', f='uploadify/uploadify.swf')
  22.     cancelImg = URL(r=request, c='static', f='uploadify/cancel.png')
  23.     url = URL(r=request, c='component', f='index.load')
  24.     script=SCRIPT(script % dict(uploader = uploader, url = url, cancelImg = cancelImg))
  25.     return dict(form=form, script=script)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement