Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Commit

Permalink
chore(merge): merge in develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rnicholus committed Sep 4, 2015
2 parents d49e87f + ccd8910 commit 9f90f8a
Show file tree
Hide file tree
Showing 293 changed files with 232 additions and 34,988 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ npm-debug.log
test/dev/handlers/s3/composer.lock
test/dev/handlers/traditional/files
test/dev/handlers/traditional/chunks
s3keys.php
s3keys.php
s3keys.sh

test/dev/handlers/vendor/*
test/dev/handlers/composer.lock
test/dev/handlers/composer.phar
3 changes: 1 addition & 2 deletions client/js/uploader.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@
},

onRetry: function(fileId) {
qq(self._templating.getFileContainer(fileId)).removeClass(self._classes.retryable);
self._templating.hideRetry(fileId);
self.retry(fileId);
},

Expand Down Expand Up @@ -250,6 +248,7 @@
}

if (newStatus === qq.status.UPLOAD_RETRYING) {
this._templating.hideRetry(id);
this._templating.setStatusText(id);
qq(this._templating.getFileContainer(id)).removeClass(this._classes.retrying);
}
Expand Down
128 changes: 109 additions & 19 deletions docs/quickstart/03-setting_up_server-s3.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,133 @@

{% block content %}
{% markdown %}

[blog]: http://blog.fineuploader.com/2013/08/16/fine-uploader-s3-upload-directly-to-amazon-s3-from-your-browser/
[packagist-url]: https://packagist.org/packages/fineuploader/php-s3-server
[repo]: https://github.com/FineUploader/php-s3-server


# Server Set-Up <small>Amazon S3</small> {: .page-header}

For this tutorial we are going to use [Node.js](http://nodejs.org/) to develop
a simple server which will accept uploads from our Fine Uploader instance. If
you don't have Node.js, now's the time to [get it](http://nodejs.org/download/).
For this tutorial we are going to use PHP to develop a simple server which will sign requests bound for S3.

If Node.js is not your style, then feel free to browse the other
If PHP is not your style, then feel free to browse the other
[server-side demos repository](http://github.com/Widen/fine-uploader-server). **It's quite important for you to read
the [Amazon S3 server-side integration instructions](../endpoint_handlers/amazon-s3.html) before you do any of this,
though**.

#### Getting Started

Let's rock! First, download [express](https://npmjs.org/package/express) and the
[aws-sdk](https://npmjs.org/package/aws-sdk):
### Getting Started

#### Step 1: Setup your S3 bucket & IAM user

Please read [our blog post on Fine Uploader S3][blog] for more information regarding setup of your buckets and IAM users.


#### Step 2: Download the sample PHP S3 signature server

We've [published an S3 endpoint PHP server for Fine Uploader to Packagist][packagist-url], which means you can easily download
it to your project using [composer][composer]!

Follow these simple steps to get a copy of the PHP traditional endpoint using Composer:

1. Download Composer: `curl -sS https://getcomposer.org/installer | php`.
2. Create a composer.json file and place it in the root of your project. See below for an example file.
3. Install the Fine Uploader S3 endpoint code: `php composer.phar install`.

An example composer.json file may look like this:

```json
{
"require": {
"fineuploader/php-s3-server": "1.0.0"
}
}
```

Be sure to update the version with the appropriate version of Fine Uploader's S3 PHP server.

`npm install express aws-sdk`

Now let's download our server:
#### Step 3: Prepare your environment

`wget -O server.js https://raw.github.com/Widen/fine-uploader-server/master/nodejs/s3/s3handler.js`
Youy will need to set 4 environment variables before starting the server. These variables will store your AWS client-side
secret key, AWS server-side public key, AWS server-side secret key, and the name of your S3 bucket. You set up
your bucket, along with all of your keys, in step 1 above.

Then set relevant environment variables:
To set your environment variables on a Unix or Linux system, you may execute 4 lines, similar to this:

```bash
$ export CLIENT_SECRET_KEY = 'secret'
$ export SERVER_PUBLIC_KEY = 'not really secret'
$ export SERVER_SECRET_KEY = 'secret'
export AWS_CLIENT_SECRET_KEY=fake/client-private-key
export AWS_SERVER_PUBLIC_KEY=fake-server-public-key
export AWS_SERVER_PRIVATE_KEY=fake/server-private-key
export S3_BUCKET_NAME=mybucket
```


#### Step 4: Start the PHP server

You can easily start up a simple HTTP server using PHP. Run the following command in the root of your web server:

```bash
php -S 0.0.0.0:8080
```

The above command will spawn a server on port 8080.


#### Step 5: Verify your Fine Uploader client-side configuration

Ensure all relevant configuration options are pointing to the path of the downloaded S3 signature endpoint server.
For example, if you placed composer.json in the root of your web server, the path to your PHP server will be
`/vendor/fineuploader/php-s3-server/endpoint.php`. You'll need to be aware of this endpoint when setting
the [`request.endpoint`](../api/options-s3.html#request.endpoint), [`signature.endpoint`](../api/options-s3.html#signature.endpoint),
and [`uploadSuccess.endpoint`](../api/options-s3.html#uploadSuccess.endpoint), and
[`deleteFile.endpoint`](../api/options.html#deleteFile.endpoint) configuration options.

A typical configuration may look like this:

```javascript
var s3Uploader = new qq.s3.FineUploader({
element: document.getElementById("fineuploader-container"),
debug: true,
request: {
endpoint: "http://mybucket.s3.amazonaws.com",
accessKey: "my-client-public-key"
},
signature: {
endpoint: "/vendor/fineuploader/php-s3-server/endpoint.php"
},
uploadSuccess: {
endpoint: "/vendor/fineuploader/php-s3-server/endpoint.php?success"
},
iframeSupport: {
localBlankPagePath: "success.html"
},
chunking: {
enabled: true,
concurrent: {
enabled: true
}
},
resume: {
enabled: true
},
retry: {
enableAuto: true,
showButton: true
},
deleteFile: {
enabled: true,
endpoint: "/vendor/fineuploader/php-s3-server/endpoint.php"
}
});
```

And let's run it!

`node server.js`
#### Step 6: Start uploading!

Fire up the HTML page with the client-side uploader code on it, and attempt to
upload.
You're all set! If you do run into any problems you can ask a question on [Stack Overflow under the fine-uploader tag][so].
Server example bugs should be reported in the [php-s3-server GitHub repository][repo].

Booyakosha! You are on the fast-track to upload nirvana. Continue forth in your quest to learn to integrate Fine Uploader with your application by reviewing the rest of the [documentation](../)
{% endmarkdown %}
{% endblock %}
110 changes: 96 additions & 14 deletions docs/quickstart/03-setting_up_server.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

{% block content %}
{% markdown %}

[composer]: https://getcomposer.org/
[packagist-url]: https://packagist.org/packages/fineuploader/php-traditional-server
[phpini]: http://php.net/manual/en/configuration.file.php
[repo]: https://github.com/FineUploader/php-traditional-server
[so]: http://stackoverflow.com/questions/tagged/fine-uploader


# Server Set-Up {: .page-header}

{{ alert(
Expand All @@ -12,33 +20,107 @@ more information on uploading to Amazon's Simple Storage Service,
read the [Fine Uploader S3 server documentation](../endpoint_handlers/amazon-s3.html).""",
"warn") }}

For this tutorial we are going to use [Node.js](http://nodejs.org/) to develop
a simple server which will accept uploads from our Fine Uploader instance. If
you don't have Node.js, now's the time to [get it](http://nodejs.org/download/).
For this tutorial we are going to use PHP to develop a simple server which will accept uploads from our Fine Uploader instance.

If Node.js is not your style, then feel free to browse the other
If PHP is not your style, then feel free to browse the other
[server-side demos repository](http://github.com/Widen/fine-uploader-server). **It's quite important for you to read
the [traditional server-side integration instructions](../endpoint_handlers/traditional.html) before you do any of this,
though**.

#### Getting Started
### Getting Started

#### Step 1: Download the example PHP server

We've [published a traditional endpoint PHP server for Fine Uploader to Packagist][packagist-url], which means you can easily download
it to your project using [composer][composer]!

Follow these simple steps to get a copy of the PHP traditional endpoint using Composer:

1. Download Composer: `curl -sS https://getcomposer.org/installer | php`.
2. Create a composer.json file and place it in the root of your project. See below for an example file.
3. Install the Fine Uploader endpoint code: `php composer.phar install`.

An example composer.json file may look like this:

```json
{
"require": {
"fineuploader/php-traditional-server": "1.0.0"
}
}
```

Be sure to update the version with the appropriate version of Fine Uploader's traditional PHP server.


#### Step 2: Prepare your environment

Be sure to include [a php.ini file][phpini] in the root of your web server with sensible request limits.
An example php.ini file looks like this:


```php
upload_max_filesize = 10M
post_max_size = 10M
```


#### Step 3: Start the PHP server

You can easily start up a simple HTTP server using PHP. Run the following command in the root of your web server:

```bash
php -S 0.0.0.0:8080 -t . -c php.ini
```

The above command will spawn a server on port 8080.


Let's rock! First, download express:
#### Step 4: Verify your Fine Uploader client-side configuration

`npm install express rimraf mkdirp`
Ensure all configuration options are pointing to the path of the downloaded traditional endpoint server. For example,
if you placed composer.json in the root of your web server, the path to your PHP server will be
`/vendor/fineuploader/php-traditional-server/endpoint.php`. You'll need to be aware of this endpoint when setting
the [`request.endpoint`](../api/options.html#request.endpoint), [`deleteFile.endpoint`](../api/options.html#deleteFile.endpoint),
and [`chunking.success.endpoint`](../api/options.html#chunking.success.endpoint) configuration options.

Now let's download our server:

`wget -O server.js https://raw.github.com/Widen/fine-uploader-server/master/nodejs/nodejs.js`
A typical configuration may look like this:

Coooool. Create a new file in your text editor called `server.js`. Time to code the first part of the server:
```javascript
var manualUploader = new qq.FineUploader({
element: document.getElementById("fineuploader-container"),
request: {
endpoint: "/vendor/fineuploader/php-traditional-server/endpoint.php"
},
deleteFile: {
enabled: true,
endpoint: "/vendor/fineuploader/php-traditional-server/endpoint.php"
},
chunking: {
enabled: true,
concurrent: {
enabled: true
},
success: {
endpoint: "/vendor/fineuploader/php-traditional-server/endpoint.php?done"
}
},
resume: {
enabled: true
},
retry: {
enableAuto: true,
showButton: true
}
});
```

And let's have node run it!
#### Step 5: Start uploading!

`node server.js`
You're all set! If you do run into any problems you can ask a question on [Stack Overflow under the fine-uploader tag][so].
Server example bugs should be reported in the [php-traditional-server GitHub repository][repo].

Make sure to set the request endpoint on your Fine Uploader instance to point to the corresponding URL on the express server. In this case, the endpoint is `/uploads`.

Booyakosha! You are on the fast-track to upload nirvana. Continue forth in your quest to learn to integrate Fine Uploader with your application by reviewing the rest of the [documentation](../)
{% endmarkdown %}
{% endblock %}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@
"uuid": "1.4.1"
},
"scripts": {
"setup-dev": "mkdir test/dev/handlers/traditional/files; mkdir test/dev/handlers/traditional/chunks",
"start-local-dev": "php -S 0.0.0.0:9090 -t . -c test/dev/handlers/php.ini",
"setup-dev": "(cd test/dev/handlers; curl -sS https://getcomposer.org/installer | php; php composer.phar install)",
"update-dev": "(cd test/dev/handlers; php composer.phar update)",
"start-local-dev": "(. test/dev/handlers/s3keys.sh; php -S 0.0.0.0:9090 -t . -c test/dev/handlers/php.ini)",
"start-c9-dev": "php -S $IP:$PORT -t . -c test/dev/handlers/php.ini"
}
}
18 changes: 10 additions & 8 deletions test/dev/devenv.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ qq(window).attach("load", function() {
fileSizeOnSubmit: true
},
request: {
endpoint: "/test/dev/handlers/traditional/endpoint.php"
endpoint: "/test/dev/handlers/vendor/fineuploader/php-traditional-server/endpoint.php"
},
deleteFile: {
enabled: true,
endpoint: "/test/dev/handlers/traditional/endpoint.php",
endpoint: "/test/dev/handlers/vendor/fineuploader/php-traditional-server/endpoint.php",
forceConfirm: true,
params: {
foo: "bar"
Expand All @@ -31,7 +31,7 @@ qq(window).attach("load", function() {
enabled: true
},
success: {
endpoint: "/test/dev/handlers/traditional/endpoint.php?done"
endpoint: "/test/dev/handlers/vendor/fineuploader/php-traditional-server/endpoint.php?done"
}
},
resume: {
Expand All @@ -47,8 +47,10 @@ qq(window).attach("load", function() {
}
},
scaling: {
sendOriginal: false,
sizes: [{name: "small", maxSize: 300}, {name: "medium", maxSize: 600}]
sizes: [{name: "small", maxSize: 300}]
},
validation: {
itemLimit: 4
},
callbacks: {
onError: errorHandler,
Expand Down Expand Up @@ -81,10 +83,10 @@ qq(window).attach("load", function() {
accessKey: "AKIAJEQ4NDFBCZAMWGUQ"
},
signature: {
endpoint: "/test/dev/handlers/s3/s3.php"
endpoint: "/test/dev/handlers/vendor/fineuploader/php-s3-server/endpoint.php"
},
uploadSuccess: {
endpoint: "/test/dev/handlers/s3/s3.php?success"
endpoint: "/test/dev/handlers/vendor/fineuploader/php-s3-server/endpoint.php?success"
},
iframeSupport: {
localBlankPagePath: "success.html"
Expand All @@ -104,7 +106,7 @@ qq(window).attach("load", function() {
},
deleteFile: {
enabled: true,
endpoint: "/test/dev/handlers/s3/s3.php",
endpoint: "/test/dev/handlers/vendor/fineuploader/php-s3-server/endpoint.php",
forceConfirm: true,
params: {
foo: "bar"
Expand Down
7 changes: 7 additions & 0 deletions test/dev/handlers/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"minimum-stability": "alpha",
"require": {
"fineuploader/php-traditional-server": "1.0.0",
"fineuploader/php-s3-server": "0.1.1"
}
}
Loading

0 comments on commit 9f90f8a

Please sign in to comment.