Giter VIP home page Giter VIP logo

Comments (6)

jessycormier avatar jessycormier commented on September 26, 2024 1

You can do this through normal input settings adding the accept attribute to the input with type set to file.

accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"

and for a full example

<div class="custom-file">
	<input
		type="file"
		class="custom-file-input"
		id="inputGroupFile04"
		accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
		multiple
		aria-describedby="inputGroupFileAddon04">
	<label class="custom-file-label" for="inputGroupFile04">Choose file</label>
</div>

from bs-custom-file-input.

jessycormier avatar jessycormier commented on September 26, 2024 1

There would be two layers that you would need to check. First being your front-end, which you can do with the provided example or by writing some code that can check the file types and prevent uploading.

The other layer would be your server, after receiving the file that is acceptable. otherwise you could return some kind of server response to your front-end.

from bs-custom-file-input.

Johann-S avatar Johann-S commented on September 26, 2024 1

Hi @Leenshady, it's not the purpose of this plugin and as @jessycormier said it's not a good practice to do that only on the front side.
BTW thanks for using my plugin and thanks @jessycormier for answering 👍

from bs-custom-file-input.

Leenshady avatar Leenshady commented on September 26, 2024

Thank you for your reply. I'm sorry for my misrepresentation. I mean when I submit a file of the wrong type, there will be friendly prompts.

from bs-custom-file-input.

Leenshady avatar Leenshady commented on September 26, 2024

I'm not familiar with the front end. If my requirement are wrong, please don't hit me, hahahaha

from bs-custom-file-input.

Leenshady avatar Leenshady commented on September 26, 2024

So I can't do this only on the front-end,right?thank you very much!

from bs-custom-file-input.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.