-
Notifications
You must be signed in to change notification settings - Fork 6
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
Upload other file-types (e.g. XML) instead of images and read their file type #4
Comments
I believe you might be able to get file type like this:
|
Hm, tried that but the string returned seems to be empty (at least for XML-Files) - for PNG-images it returns "image/png" . |
I have not tried this with other files apart from images. I'll find some time this week to look into it, but meanwhile you can try to extract file extension from a file name. |
Some more tests:
@Pukkah : Yes, I will try that. Thanks for the support so far. |
Checking extension yourself or even validating the contents of the file might be a better solution when dealing with text files.
|
I found a way to get text files to work. In input.setAttribute("accept", "image/png, image/jpeg, image/webp"); |
Hello and thanks for this nice addon,
I was able to make it run on text-based files like XML (see Link). However, I was not able to read out the file-type for such files. The returned variable seems empty.
As an example, I would like to handle uploads differently for *.JSON and *.XML files (but using the same Upload button, if possible).
Thanks!
The text was updated successfully, but these errors were encountered: