Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngs3upload

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngs3upload - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

bower.json
{
"name": "ng-s3upload",
"version": "0.1.1",
"version": "0.1.2",
"main": "build/ng-s3upload.js",

@@ -5,0 +5,0 @@ "dependencies": {

{
"name": "ngs3upload",
"version": "0.1.1",
"version": "0.1.2",
"main": "build/ng-s3upload.js",
"dependencies": {},

@@ -5,0 +6,0 @@ "devDependencies": {

@@ -6,7 +6,7 @@ ng-s3upload - Upload to S3 using AngularJS

## Setup
## Setup
1. Create AWS S3 bucket
2. Grant "put/delete" permissions to everyone
In AWS web interface, select S3 and select the destination bucket, then
2. Grant "put/delete" permissions to everyone
In AWS web interface, select S3 and select the destination bucket, then
expand the "Permissions" sections and click on the "Add more permissions" button. Select "Everyone" and "Upload/Delete" and save.

@@ -16,4 +16,4 @@

In AWS web interface, select S3 and select the wanted bucket.
Expand the "Permissions" section and click on the "Add CORS configuration" button. Paste the wanted CORS configuration, for example:
In AWS web interface, select S3 and select the wanted bucket.
Expand the "Permissions" section and click on the "Add CORS configuration" button. Paste the wanted CORS configuration, for example:
```XML

@@ -46,3 +46,3 @@ <?xml version="1.0" encoding="UTF-8"?>

4. Create a server side service that will return the needed details for uploading files to S3.
your service shall return a json in the following format:
your service shall return a json in the following format:

@@ -59,3 +59,3 @@ ```json

ZZZ - Your public key
Here's a rails example, even if you're not a rails developer, read the code, it's very straight forward.
Here's a rails example, even if you're not a rails developer, read the code, it's very straight forward.

@@ -82,3 +82,3 @@ For a php example, please refer to [this guide](https://github.com/asafdav/ng-s3upload/wiki/PHP-Creating-the-S3-Policy).

"expiration" => 1.hour.from_now.utc.xmlschema,
"conditions" => [
"conditions" => [
{ "bucket" => GLOBAL[:aws_bucket] },

@@ -97,12 +97,12 @@ [ "starts-with", "$key", "" ],

```
The following code generates an upload policy that will be used by S3, in this example the maximum file size is limited to 10MB (10 * 1024 * 1024), update it to match your requirments. for a full list of S3's policy options, please refer to [AWS documentation](http://docs.aws.amazon.com/AmazonS3/latest/dev/HTTPPOSTExamples.html#HTTPPOSTExamplesTextAreaPolicy).
## How to get it ?
## How to get it ?
#### Manual Download
Download the from [here](https://github.com/asafdav/ng-s3upload/releases)
#### Bower
#### Bower
```

@@ -134,13 +134,23 @@ bower install ng-s3upload

attributes:
attributes:
* bucket - Specify the wanted bucket
* s3-upload-options - Provide additional options:
* getOptionsUri - The uri of the server service that is needed to sign the request (mentioned in section Setup#4) - Required.
* getOptionsUri - The uri of the server service that is needed to sign the request (mentioned in section Setup#4) - Required if second option is empty.
* getManualOptions - if for some reason you need to have your own mechanism of getting a policy, you can simply assign your scope variable to this option. Note it should be resolved on the moment of directive load.
* folder - optional, specifies a folder inside the bucket the save the file to
* enableValidation - optional, set to "false" in order to disable the field validation.
* targetFilename - An optional attribute for the target filename. if provided the file will be renamed to the provided value instead of having the file original filename.
## Themes
ng-s3upload allows to customize the directive template using themes. Currently the available themes are: bootstrap2, bootstrap3
#### How to?
```javascript
app.config(function(ngS3Config) {
ngS3Config.theme = 'bootstrap3';
});
```
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/asafdav/ng-s3upload/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

@@ -33,2 +33,3 @@ angular.module('ngS3upload.directives', []).

getOptionsUri: '/getS3Options',
getManualOptions: null,
acl: 'public-read',

@@ -59,3 +60,13 @@ uploadingKey: 'uploading',

S3Uploader.getUploadOptions(opts.getOptionsUri).then(function (s3Options) {
if(angular.isObject(opts.getManualOptions)) {
_upload(opts.getManualOptions);
} else {
S3Uploader.getUploadOptions(opts.getOptionsUri).then(function (s3Options) {
_upload(s3Options);
}, function (error) {
throw Error("Can't receive the needed options for S3 " + error);
});
}
function _upload(s3Options){
if (opts.enableValidation) {

@@ -92,7 +103,3 @@ ngModel.$setValidity('uploading', false);

});
}, function (error) {
throw Error("Can't receive the needed options for S3 " + error);
});
}
};

@@ -99,0 +106,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc