Skip to content

Commit

Permalink
Fixed: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nerv committed Apr 13, 2014
1 parent a4217d1 commit f843559
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,41 +149,41 @@ uploader.bind('progress', function(event, item, progress) {
### FAQ
1. How to add the previously uploaded files in the queue?

```javascript
// Add a item to the queue
var item = {
file: {
name: 'Your file name',
size: 1e6
},
progress: 100,
isUploaded: true,
isSuccess: true
};
item.remove = function() {
uploader.removeFromQueue(this);
};
uploader.queue.push(item);
uploader.progress = 100;
```
```javascript
// Add a item to the queue
var item = {
file: {
name: 'Your file name',
size: 1e6
},
progress: 100,
isUploaded: true,
isSuccess: true
};
item.remove = function() {
uploader.removeFromQueue(this);
};
uploader.queue.push(item);
uploader.progress = 100;
```

2. How do I deal with Cross Site Request Forgery protection?

See this issue: [#40](https://github.com/nervgh/angular-file-upload/issues/40)
See this issue: [#40](https://github.com/nervgh/angular-file-upload/issues/40)

For example, in Ruby on Rails, add an additional header, and use [this method](http://stackoverflow.com/questions/14734243/rails-csrf-protection-angular-js-protect-from-forgery-makes-me-to-log-out-on#answers) for verifying XSRF:
For example, in Ruby on Rails, add an additional header, and use [this method](http://stackoverflow.com/questions/14734243/rails-csrf-protection-angular-js-protect-from-forgery-makes-me-to-log-out-on#answers) for verifying XSRF:

```javascript
var csrf_token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');

var uploader = $scope.uploader = $fileUploader.create({
// your code here...
headers : {
'X-CSRF-TOKEN' : csrf_token // X-CSRF-TOKEN is used for Ruby on Rails Tokens
},
//...
});
```
```javascript
var csrf_token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
var uploader = $scope.uploader = $fileUploader.create({
// your code here...
headers : {
'X-CSRF-TOKEN' : csrf_token // X-CSRF-TOKEN is used for Ruby on Rails Tokens
},
//...
});
```

---

Expand Down Expand Up @@ -331,20 +331,20 @@ uploader.bind('progress', function(event, item, progress) {
### FAQ / Вопросы и ответы
1. Как добавить ранее загруженные файлы в очередь?

```javascript
// Add a item to the queue
var item = {
file: {
name: 'Your file name',
size: 1e6
},
progress: 100,
isUploaded: true,
isSuccess: true
};
item.remove = function() {
uploader.removeFromQueue(this);
};
uploader.queue.push(item);
uploader.progress = 100;
```javascript
// Add a item to the queue
var item = {
file: {
name: 'Your file name',
size: 1e6
},
progress: 100,
isUploaded: true,
isSuccess: true
};
item.remove = function() {
uploader.removeFromQueue(this);
};
uploader.queue.push(item);
uploader.progress = 100;
```

0 comments on commit f843559

Please sign in to comment.