Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How can I upload files using angularjs? I need to upload .xls files so need an extension check and also need to read the data and display it in a table before posting it to PHP server.

share|improve this question
    
Whats the -1 for ? If you do not know the answer please do not vote down or if you do give a valid reason –  Bhumi Singhal Mar 20 '14 at 9:42
    
I didn't downvote, but, you should add more details. What is on the backend? What do you mean by API? A client side API or a server side API? –  Jonathan Mar 20 '14 at 9:54
    
If your question is simply "How can I upload files using angularjs?", there are several duplicates with good answers like this one: stackoverflow.com/questions/18571001/…. Please clarify your specific case or tell us what have you found/tried so far. –  glepretre Mar 20 '14 at 10:05

1 Answer 1

Angular is a client side framework so a file upload is not going to be anything out of the ordinary. At the DOM level it will just use an HTML form with the file input field.

The Angular way would be to write a directive that wraps the upload form.

Angular isn't going to give you anything special for actually saving the file anywhere. Implement something in the backend to receive the file being uploaded. This is such a common requirement that I am sure there is an example out there for whatever language you are using.

There are a couple of directives already written. For example, I used this on a recent project.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.