Another multiple file upload and file drop area demo, this time using dropzone.js

881 views
Skip to first unread message

Leonel Câmara

unread,
Dec 16, 2013, 1:21:01 PM12/16/13
to web...@googlegroups.com
I did this to see how I could integrate dropzone.js ( http://www.dropzonejs.com/ )  with web2py as I'm thinking of using it in some of my projects.

Hopefuly it can be useful to someone else.

In this demo you have:
- drop files in an area of the page to upload them.
- CSFR protection (if someone could validate it, that'd be great, I'm no security expert).
- Fallback html form working along side dropzone.
- List files the user already uploaded, interact with them the same way you do with files you have just uploaded.
- Delete files.
- Thumbnails.
- Demonstration of how to compute filesize of an upload.
- Uploads progress bar.


Any comments, or bug reports, you guys may make are appreciated and welcomed.
web2py.app.dropzonetest.w2p

Alan Etkin

unread,
Dec 16, 2013, 6:33:53 PM12/16/13
to web...@googlegroups.com
 
Hopefuly it can be useful to someone else.

Perhaps you want to post this also in web2pyslices.com, which has a packages database. Also consider making a plugin of the feature for more portability between apps (the admin app now supports automatic download and installation of plugins).

Massimo Di Pierro

unread,
Dec 16, 2013, 10:31:47 PM12/16/13
to web...@googlegroups.com
Nice! I added it to the appliances repository.

Ruud Schroen

unread,
Dec 17, 2013, 7:15:39 AM12/17/13
to web...@googlegroups.com
Nice! I'll try it out later today!

Just one question, does the web2py validation also work on this? For example IS_IMAGE?

Leonel Câmara

unread,
Dec 17, 2013, 7:22:07 AM12/17/13
to web...@googlegroups.com
Yes, all validators work since the usual SQLFORM form processing is always done. IS_IMAGE is actually demonstrated to work in this demo as we needed that to make the thumbnails.

Ruud Schroen

unread,
Dec 17, 2013, 7:38:26 AM12/17/13
to web...@googlegroups.com
Ah! Very nice :)


On Tue, Dec 17, 2013 at 1:22 PM, Leonel Câmara <leonel...@gmail.com> wrote:
Yes, all validators work since the usual SQLFORM form processing is always done. IS_IMAGE is actually demonstrated to work in this demo as we needed that to make the thumbnails.

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Em-oZbCWPNQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Morten Frellumstad

unread,
Feb 24, 2014, 5:54:45 AM2/24/14
to web...@googlegroups.com
Just what I was looking for :)
Thanks!
PS! I had to update dropzone.js to make it work with Chrome.

Regards

Morten


On Monday, December 16, 2013 7:21:01 PM UTC+1, Leonel Câmara wrote:

Spokes

unread,
Aug 9, 2014, 10:18:11 AM8/9/14
to
Thank you for the demo - very useful! It would be fantastic if there were a web2py module or feature that implements this sort of functionality.

 However, I'm curious as to why it's necessary to use "uploadseparate=True" for the upload fields in the db table. Is there a way to get this to function with "uploadseparate=False" instead? If not, is there a convenient, automatic way, when a file and its thumbnail are deleted, to have their folders deleted as well? Thanks!

Massimo Di Pierro

unread,
Aug 9, 2014, 12:53:04 PM8/9/14
to web...@googlegroups.com
uploadseparate makes sure that if you have many uploads they are stored in different (sub)folders. This is important for speed because if you have more than 1000 files in a folder accessing the file system is a bottle neck. This does not affect the demo but it is good practice to use uploadseparate. It should have been the default option but it is not for backward compatibility.

Oli

unread,
Aug 9, 2014, 2:31:32 PM8/9/14
to web...@googlegroups.com
is there a possibilty to change the number of folders/files or set the folders to year/month/day?

Spokes

unread,
Aug 9, 2014, 4:46:49 PM8/9/14
to web...@googlegroups.com
Thanks, Massimo. I wasn't aware of that. Looks like I should start changing certain fields to "uploadseparate = True" rather than the other way around.

However, as I mentioned, in the demo mentioned in this thread, when files are deleted, the folders that used to contain them remain. Is this a feature specific to this demo, or is this generally the case when using "uploadseparate = True"? If it's the latter, is there some automatic way for those folders to be deleted when their corresponding files are deleted?

Massimo Di Pierro

unread,
Aug 9, 2014, 10:27:56 PM8/9/14
to web...@googlegroups.com
In the near future we may have a smarter mechanism for this....

Rahul

unread,
Aug 11, 2014, 4:40:23 AM8/11/14
to web...@googlegroups.com
I dont seem to find it in Appliances section.  What is the appliance name ??

Rahul

Leonel Câmara

unread,
Aug 11, 2014, 4:49:47 AM8/11/14
to web...@googlegroups.com

Rahul

unread,
Aug 11, 2014, 5:24:23 AM8/11/14
to web...@googlegroups.com
Thanks! for the quick turn around. Got it.  I mis-took appliances to web2py.com / appliances section .

Rahul

On Monday, August 11, 2014 2:19:47 PM UTC+5:30, Leonel Câmara wrote:
https://github.com/mdipierro/web2py-appliances/tree/master/DropZone

Spokes

unread,
Aug 11, 2014, 3:00:14 PM8/11/14
to web...@googlegroups.com
Thanks - looking forward to the updates!

Omar Meat Boy Gutiérrez

unread,
Aug 11, 2014, 5:10:47 PM8/11/14
to web...@googlegroups.com

It is a great thing, undoubtedly.
Reply all
Reply to author
Forward
0 new messages