-
Notifications
You must be signed in to change notification settings - Fork 949
File Upload Widget v2 #2258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File Upload Widget v2 #2258
Conversation
@oscar6echo it seems you have a conflict file in your PR. |
@oscar6echo is there a way to get files' URL? |
Yes this PR is quite old. Not sure I understand "a way to get files' URL" ? Do you mean to get a file from a URL ? If so the Python requests packages seems able to to that, right ? |
hey @oscar6echo thanks for the quick answer.
generally, you need to 1) configure a remote upstream and 2) run the rebase with upstream/master.
if there is no conflict, it will show 1) the commits you have, you can just save and exit this file .. and 2) it will show a file with the commits related to this rebase. 3) now you can push with if there are any conflict you should resolve each conflict. Remember you are changing the |
Sorry for the delay in merging. @SylvainCorlay is merging things in preparation for a 7.5 release. It would be awesome to get this in. |
It looked like the merge conflict was easy to resolve, so I went ahead and resolved it. I haven't tested or reviewed the PR, though. |
that is awesome! thanks @jasongrout ! if I can help in anyway let me know.
I mean after the upload is there a way to get the URL of the file? so the user can get this URL and if he want to download the file they can just click on a link. |
@oscar6echo I believe @xmnlab was wondering if it was possible to use FileUpload to get ahold of the filepath of the file(s) being uploaded. I'm interested in a similar case as to that, where we basically want to let a user navigate their directories, select a file, and then feed the filepath (aka So far, I believe this is not possbile by your method, since FileUpload relies on the FileReader Web API, and the API doesn't allow accessing the OS directories directly for security reasons. I'm wondering if you can confirm this to be correct, and perhaps suggest an alternative? A simple ipywidget Button implemention is the closest I've gotten, but it's not great. |
hey @thomasaarholt @oscar6echo ! some example about what I mean is the approach used here: deathbeds/wxyz#5 ... if you try the binder notebook, after you upload a file .. it returns a link if you want to download the uploaded file. |
Can we update the default style? It does not match the rest of ipywidgets. |
8f5255d
to
eaeee82
Compare
eaeee82
to
b888280
Compare
b888280
to
8ec07cd
Compare
Rebased the PR and fixed the tests. Will do a more thorough review / cleanup before merging tomorrow. |
e6aa936
to
34f290c
Compare
Been looking forward to this addition, awesome stuff! |
0d63f77
to
c3ea8e8
Compare
I have iterated a bit on the PR
|
Just wondering, is there an event handler for when the files are done uploading? Also, can a user change the label of the widget button? Edit: @SylvainCorlay after looking at the latest commit, it looks like the button would behave like any other button in terms of styling? Is that correct? So in that case, a user could set description and icon as they wish? |
Yes, the change in the
Absolutely, except that there is a default icon and default description that are not empty. |
I think we need to iterate a bit more on this.
|
OK, the binary serialization and mime type detection work got me to find a bug in |
Could it be #1748 ? |
No, it is really silly. We need a custom seralizer being identity to prevent the JSON stringification of ArrayBuffer which returns nothing. |
Ah yes, I believe it is a feature, @jasongrout knows the reasoning behind it, and there are good reasons for it I believe, but it has bitten many people (the Image widget has this as well I believe). |
c3ea8e8
to
44a2af9
Compare
I think that the current state is fine. I am still hesitant about two things
DONE.
|
44a2af9
to
2e90a4f
Compare
Perhaps a convenience method on the python side that basically is the one line to do the decoding with a default of utf8? |
7b23d63
to
2945ab4
Compare
This is ready to go. Will merge in a little. |
As per discussion on gitter. We may add an example with |
? |
@SylvainCorlay When I attempted this widget before I used a read_mode attribute with a default as 'text'.
In my use case, yeah reading csv files is exactly what I would do, i.e. StringIO->pandas.read_csv()... |
Thanks @rskabelund! The issue with reading as text is how to deal with encoding. When only uploading binary is that the choice is left to the user. |
723df20
to
9e975f6
Compare
Thanks guys for this widget (especially to author), appreciate your work. I assume that this will be available from the next release? I tried standalone library, but in my case huge downside was inability to customize button name. Glad to hear that this will be fixed in the official version... |
The upload widget is in the 7.5 release. |
I missed it somehow in documentation, it's really there. Oh god, I spent whole one day to implement the same thing through the combination of HTML and Javascript, only to have custom name in button. :( But ok... Thanks Jason one more time! |
It’s good to learn new thing anyway. |
This is an import of the custom widget ipyupload