Closed crisbeto closed 8 years ago
@stephenmcd do you consider there's anything else that needs to be added? The only one, that I didn't manage to figure out how it was supposed to work, was the endpoint that checks whether the file is already uploaded (it just kept returning an empty JSON).
The file replace dialog works now as well.
Hi Kristiyan, I'm trying out your fork because I'm having trouble with the Flash uploader. It looks great and works fairly well... but there was one minor bug that made it so I couldn't upload certain file types - the line in upload.html that determines allowed extensions was missing a comma between categories!
Basically, on line 43 of filebrowser_safe/tempaltes/filebrowser/upload.html:
data-allowed-extensions="{% for extension in settings_var.EXTENSIONS.items %}{% ifnotequal extension.0 'Folder' %}{% for item in extension.1 %}{{ item|safe }}{% if not forloop.last %},{% endif %}{% endfor %}{% endifnotequal %}{% endfor %}"
needs a
{% if not forloop.last %},{% endif%}
just before the {%endifnotequal%}
Have made this change on my fork of your repo here: https://github.com/molokov/filebrowser-safe/commit/63601a152bb25c12a813947d44410b8f086dc48a
Ah, I see what you mean, sometimes it outputs .extension.other_extension
. That whole line is a bit of a mess that I copy pasted from the old config. It makes more sense to use a template tag to output the list.
I've updated my fork as well. Thanks for the heads up!
Yeah, a template tag is probably smarter. There's also the settings.EXTENSION_LIST which has already created a list of all extensions, although it doesn't exclude 'Folder' like your code does.
https://github.com/crisbeto/filebrowser-safe/blob/master/filebrowser_safe/settings.py#L102-L104
Another possible issue - I have added "All" : ".*" to my FILEBROWSER_EXTENSIONS dictionary, to allow any file type to be uploaded, but this won't work with the current extension check, as it's looking for a literal asterisk character, rather than globbing... but to be honest, I'd be prepared to live with this limitation as administrators probably should limit the types of files that can be uploaded.
Yeah, there isn't really a built-in way to do globbing. Did the old Flash-based upload allow patterns like that? I only used it for a week or two before browsers started auto-blocking Flash.
From what I recall, the flash uploader used the EXTENSIONS setting to create a list of available extensions in the File Dialog drop down - all in one big list. I think that's why I added .* because some other default types that I thought should be there were missing. It usually produced an unreadable list, but did allow you to select whatever files matched that list. It did also allow multi-select.
I like the HTML5 a little better - select one file, any file, and the uploader tells you immediately if it's not allowed, and the Help section details them all.
I think as long as similar functionality is present, it doesn't matter too much if the details are different.
(I had a different issue too where the flash uploader wouldn't work for me in Firefox, but worked fine in Chrome... I had to swap browsers whenever uploading files. This new one works fine in Firefox too :) )
Funny, in my case it worked everywhere, except Chrome. I initially overrode the template and disabled uploadify altogether and let it use the good ol' input[type="file"]
.
Is there any movement on this getting merged? Would be really great to have this. Uploadify based filebrowser is not working at all on my mac at this point.
No idea, I still haven't had any feedback from the maintainers. As a workaround you can try installing my fork or overriding the upload.html in your templates and removing the script tags that initializes Uploadify. This lets it fall back to the simple upload button that doesn't let you see progress and upload multiple files, but at least it works everywhere.
Thanks @crisbeto I'll try the workaround for now.
Sorry for the delay on this - I just tested it and it's great, we'll merge it.
BTW where does upload.js come from? Is it a library?
EDIT: Good to go.
It's not a library, it's a custom script that just wraps the native XHR2. If it doesn't support XHR2, it falls back to the regular form uploads. Seems like there are some merge conflicts, I'll try to resolve them today.
Replaces Uploadify with a XHR2 uploader. Closes https://github.com/stephenmcd/filebrowser-safe/issues/33 and https://github.com/stephenmcd/mezzanine/issues/875