Skip to content
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

Cannot use drag and drop file upload if file suffix is written in CAPS #10746

Open
1 task done
tosterloh opened this issue Mar 6, 2025 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@tosterloh
Copy link

tosterloh commented Mar 6, 2025

Describe the bug

We implemented a chat application with file upload. We added the file upload via:

SUPPORTED_FILES = [".txt"]
file_input = gr.File(
                            label="Upload files",
                            file_types=SUPPORTED_FILES,
                            file_count="multiple",
                            container=True,
                            height="20vh"
                        )

If we use the file upload dialog, we can upload .txt files as well as .TXT files. But if we use the drag and drop feature, we can only upload .txt files. If we try to drag and drop .TXT files we get the error message: Invalid file type only .txt allowed.

It is very weird that the upload dialog and the drag and drop feature behave differently.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

with gr.Blocks() as demo:
    SUPPORTED_FILES = [".txt"]
    file_input = gr.File(
        label="Upload files", file_types=SUPPORTED_FILES, file_count="multiple", container=True, height="20vh"
    )

demo.launch()

Start the app and try uploading a file with .TXT suffix and the error will occur.

If you change SUPPORTED_FILES = [".txt", ".TXT"] drag and drop will work for .TXT

Nevertheless, IMO the different behavior between file upload dialog and drag and drop is very strange.

Screenshot

Image

Logs

System Info

Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 5.20.0
gradio_client version: 1.7.2

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.8.0
audioop-lts is not installed.
fastapi: 0.115.11
ffmpy: 0.5.0
gradio-client==1.7.2 is not installed.
groovy: 0.1.2
httpx: 0.28.1
huggingface-hub: 0.29.2
jinja2: 3.1.5
markupsafe: 2.1.5
numpy: 2.2.3
orjson: 3.10.15
packaging: 24.2
pandas: 2.2.3
pillow: 11.1.0
pydantic: 2.10.6
pydub: 0.25.1
python-multipart: 0.0.20
pyyaml: 6.0.2
ruff: 0.9.9
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.46.0
tomlkit: 0.13.2
typer: 0.15.2
typing-extensions: 4.12.2
urllib3: 2.3.0
uvicorn: 0.34.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2025.2.0
httpx: 0.28.1
huggingface-hub: 0.29.2
packaging: 24.2
typing-extensions: 4.12.2
websockets: 15.0.1

Severity

I can work around it

@tosterloh tosterloh added the bug Something isn't working label Mar 6, 2025
@abidlabs
Copy link
Member

abidlabs commented Mar 6, 2025

cc @dawoodkhan82 for visibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants