rstudio / shiny

Easy interactive web applications with R
https://shiny.posit.co/
Other
5.36k stars 1.87k forks source link

[Idea] updateFileInput() - use a server-side file in place of an uploaded file, would be especially useful for testing #1721

Open daattali opened 7 years ago

daattali commented 7 years ago

Somewhat to #1720

When developing apps that require file uploads, I often find myself wishing I could programmatically set the value of a fileInput because I don't want to have to perform multiple clicks and find the right file every time I'm testing/developing. I do have a solution for myself to do that automatically, but it would be nice if shiny had a proper way to define the file. And extra points if it supported NULL.

daattali commented 7 years ago

@bborgesr what did you edit? Or is this some bot? I tried adding more content, and when I hit "Update comment" it told me my content is out of date and it just deleted what I said! How rude.

Anyway, it looks like @vnijs has made this suggestion way back before I knew what R is :) But he promptly cancelled his idea so it never got any feedback #281

bborgesr commented 7 years ago

@daattali It appears as if I edit every issue a few minutes after it's created. That's unfortunate, but it has a benign explanation: it's a by-product of Unito using my account to sync Github and our private Asana account, that we use to keep track of all our work. The only thing that occurs to me is that you tried to edit it soon after posting it? And maybe you and the Unito bot were both trying to access the raw content (the bot to copy it and you to modify it) at the same time. I'm pretty sure if you try again, that shouldn't happen (it hasn't happened to me before). But otherwise, let us know and we can to see if there's anything we can do!

daattali commented 7 years ago

Just saw @jcheng5 casually suggesting to someone they use updateFileInput() - I hope this means that you are indeed approving this idea? :)

daattali commented 7 years ago

I can maybe look into submitting a PR if you approve

wch commented 7 years ago

I think an updateFileInput PR would be great. We'd definitely look at a PR.

daattali commented 7 years ago

@wch is there a way to modify an input's value on demand without going through the normal reactive flow? I was hoping code within the shiny package would have the ability to do that without the "attempted to assign value to read-only reactiveValues object"

daattali commented 7 years ago

Nevermind, figured it out! You guys really did make it difficult to do things that we're not supposed to do :)

nuno-agostinho commented 3 years ago

Hey all, I would like to know the situation on this. An updateFileInput would allow to easily reset a chosen file if needed, which would be great without resorting other ways using JS and whatnot. Thanks!

scaramuzzini commented 2 years ago

In my case updateFileInput will help with i18n on label and others.

eamcvey commented 8 months ago

I was disappointed to discover there's no updateFileInput() function because I'd like to update the multiple argument. In my app, the user has three options in a radioButton input. One of them allows for multiple files, the others should not. Just adding this as another motivating use case for updateFileInput() (though I may discover that there's another simple way to accomplish this).