Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def myform():
- response.files.append(URL(r=request, c='static', f='uploadify/uploadify.css'))
- response.files.append(URL(r=request, c='static', f='uploadify/swfobject.js'))
- response.files.append(URL(r=request, c='static', f='uploadify/jquery.uploadify.v2.1.4.min.js'))
- form = SQLFORM(db.image)
- if request.post_vars:
- c=request.post_vars.Filedata
- db.image.insert(file = db.image.file.store(c.file, c.filename))
- script= """
- $(document).ready(function() {
- $('#image_file').uploadify({
- 'uploader' : '%(uploader)s',
- 'script' : '%(url)s',
- 'cancelImg' : '%(cancelImg)s',
- auto:true
- });
- });
- """
- uploader = URL(r=request, c='static', f='uploadify/uploadify.swf')
- cancelImg = URL(r=request, c='static', f='uploadify/cancel.png')
- url = URL(r=request, c='component', f='index.load')
- script=SCRIPT(script % dict(uploader = uploader, url = url, cancelImg = cancelImg))
- return dict(form=form, script=script)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement