1

I want to create multiupload file component with possibility of removing added files dynamically with javascript (when user click on close button on file preview).

I tried to use <input type="file" name="files[]" multiple/> But as I found later there is no possibility of changing file input value dynamically :(

So what should I do for solving this problem? How to make possibility of removing files from form after it has been added by user?

3
  • Once you are using jquery, why not take some plugin? There are tons of plugins with multiple files upload Commented Nov 28, 2012 at 8:55
  • And... what have you tried? Or you want SO to make your work for you? Commented Nov 28, 2012 at 8:57
  • I don't know how to remove files from input, so I tried nothing. Commented Nov 28, 2012 at 9:11

1 Answer 1

1

First: take a look at this article. Here is how you can make multiple file upload (very simple, file is selected one by one)

Second: I do not think you can edit list of files in <input type="file" multiple /> with JS. According to this .files property is readonly (so you can get a list of files, but noting more). But at the same time, take a look at this. There you can find how to upload files with ajax. Once you can do that, you can show a list of selected files and allow user to remove some of them. And upload only files that are still in a list of selected files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.