larsklevan_s3_swf_upload 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/CHANGELOG +26 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/Manifest +34 -0
- data/README.textile +222 -0
- data/Rakefile +14 -0
- data/flex_src/bin-release/flex-config.xml +356 -0
- data/flex_src/compile +2 -0
- data/flex_src/src/Globals.as +15 -0
- data/flex_src/src/S3Uploader.as +204 -0
- data/flex_src/src/com/adobe/net/MimeTypeMap.as +196 -0
- data/flex_src/src/com/elctech/S3UploadOptions.as +31 -0
- data/flex_src/src/com/elctech/S3UploadRequest.as +254 -0
- data/flex_src/src/com/nathancolgate/s3_swf_upload/BrowseButton.as +55 -0
- data/flex_src/src/com/nathancolgate/s3_swf_upload/S3Queue.as +117 -0
- data/flex_src/src/com/nathancolgate/s3_swf_upload/S3Signature.as +116 -0
- data/flex_src/src/com/nathancolgate/s3_swf_upload/S3Upload.as +111 -0
- data/lib/patch/integer.rb +12 -0
- data/lib/s3_swf_upload.rb +10 -0
- data/lib/s3_swf_upload/railtie.rb +16 -0
- data/lib/s3_swf_upload/railties/generators/s3_swf_upload.rb +19 -0
- data/lib/s3_swf_upload/railties/generators/uploader/USAGE +10 -0
- data/lib/s3_swf_upload/railties/generators/uploader/templates/amazon_s3.yml +20 -0
- data/lib/s3_swf_upload/railties/generators/uploader/templates/s3_down_button.gif +0 -0
- data/lib/s3_swf_upload/railties/generators/uploader/templates/s3_over_button.gif +0 -0
- data/lib/s3_swf_upload/railties/generators/uploader/templates/s3_up_button.gif +0 -0
- data/lib/s3_swf_upload/railties/generators/uploader/templates/s3_upload.js +118 -0
- data/lib/s3_swf_upload/railties/generators/uploader/templates/s3_upload.swf +0 -0
- data/lib/s3_swf_upload/railties/generators/uploader/templates/s3_uploads_controller.rb +53 -0
- data/lib/s3_swf_upload/railties/generators/uploader/uploader_generator.rb +20 -0
- data/lib/s3_swf_upload/railties/tasks/crossdomain.xml +5 -0
- data/lib/s3_swf_upload/s3_config.rb +43 -0
- data/lib/s3_swf_upload/signature.rb +203 -0
- data/lib/s3_swf_upload/view_helpers.rb +171 -0
- data/s3_swf_upload.gemspec +28 -0
- metadata +106 -0
data/flex_src/compile
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
package {
|
2
|
+
|
3
|
+
import flash.events.*;
|
4
|
+
import flash.external.*;
|
5
|
+
import flash.net.*;
|
6
|
+
import flash.display.*;
|
7
|
+
import flash.system.Security;
|
8
|
+
import com.nathancolgate.s3_swf_upload.*;
|
9
|
+
|
10
|
+
public class S3Uploader extends Sprite {
|
11
|
+
|
12
|
+
//File Reference Vars
|
13
|
+
public var queue:S3Queue;
|
14
|
+
public var file:FileReference;
|
15
|
+
|
16
|
+
private var _multipleFileDialogBox:FileReferenceList;
|
17
|
+
private var _singleFileDialogBox:FileReference;
|
18
|
+
private var _fileFilter:FileFilter;
|
19
|
+
|
20
|
+
//config vars
|
21
|
+
private var _fileSizeLimit:Number; //bytes
|
22
|
+
private var _queueSizeLimit:Number;
|
23
|
+
private var _selectMultipleFiles:Boolean;
|
24
|
+
|
25
|
+
private var cssLoader:URLLoader;
|
26
|
+
public static var s3_swf_obj:String;
|
27
|
+
|
28
|
+
public function S3Uploader() {
|
29
|
+
super();
|
30
|
+
S3Uploader.s3_swf_obj = LoaderInfo(root.loaderInfo).parameters.s3_swf_obj;
|
31
|
+
registerCallbacks();
|
32
|
+
}
|
33
|
+
|
34
|
+
private function registerCallbacks():void {
|
35
|
+
if (ExternalInterface.available) {
|
36
|
+
ExternalInterface.addCallback("init", init);
|
37
|
+
ExternalInterface.call(S3Uploader.s3_swf_obj+'.init');
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
private function init(signatureUrl:String,
|
42
|
+
prefixPath:String,
|
43
|
+
fileSizeLimit:Number,
|
44
|
+
queueSizeLimit:Number,
|
45
|
+
fileTypes:String,
|
46
|
+
fileTypeDescs:String,
|
47
|
+
selectMultipleFiles:Boolean,
|
48
|
+
buttonWidth:Number,
|
49
|
+
buttonHeight:Number,
|
50
|
+
buttonUpUrl:String,
|
51
|
+
buttonDownUrl:String,
|
52
|
+
buttonOverUrl:String
|
53
|
+
):void {
|
54
|
+
// ExternalInterface.call('s3_swf.jsLog','Initializing...');
|
55
|
+
|
56
|
+
flash.system.Security.allowDomain("*");
|
57
|
+
|
58
|
+
// UI
|
59
|
+
var browseButton:BrowseButton = new BrowseButton(buttonWidth,buttonHeight,buttonUpUrl,buttonDownUrl,buttonOverUrl);
|
60
|
+
addChild(browseButton);
|
61
|
+
|
62
|
+
|
63
|
+
stage.showDefaultContextMenu = false;
|
64
|
+
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
|
65
|
+
stage.align = flash.display.StageAlign.TOP_LEFT;
|
66
|
+
|
67
|
+
this.addEventListener(MouseEvent.CLICK, clickHandler);
|
68
|
+
|
69
|
+
// file dialog boxes
|
70
|
+
// We do two, so that we have the option to pick one or many
|
71
|
+
_fileSizeLimit = fileSizeLimit;
|
72
|
+
_fileFilter = new FileFilter(fileTypeDescs, fileTypes);
|
73
|
+
_queueSizeLimit = queueSizeLimit;
|
74
|
+
_selectMultipleFiles = selectMultipleFiles;
|
75
|
+
_multipleFileDialogBox = new FileReferenceList;
|
76
|
+
_singleFileDialogBox = new FileReference;
|
77
|
+
_multipleFileDialogBox.addEventListener(Event.SELECT, selectFileHandler);
|
78
|
+
_singleFileDialogBox.addEventListener(Event.SELECT, selectFileHandler);
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
// Setup Queue, File
|
83
|
+
this.queue = new S3Queue(signatureUrl,prefixPath);
|
84
|
+
Globals.queue = this.queue;
|
85
|
+
|
86
|
+
ExternalInterface.addCallback("removeFileFromQueue", removeFileHandler);
|
87
|
+
// ExternalInterface.call('s3_swf.jsLog','Initialized');
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
// called when the browse button is clicked
|
92
|
+
// Browse for files
|
93
|
+
private function clickHandler(event:Event):void{
|
94
|
+
// ExternalInterface.call('s3_swf.jsLog','clickHandler');
|
95
|
+
if(_selectMultipleFiles == true){
|
96
|
+
// ExternalInterface.call('s3_swf.jsLog','Opening Multiple File Dialog box...');
|
97
|
+
_multipleFileDialogBox.browse([_fileFilter]);
|
98
|
+
// ExternalInterface.call('s3_swf.jsLog','Multiple File Dialog box Opened');
|
99
|
+
} else {
|
100
|
+
// ExternalInterface.call('s3_swf.jsLog','Opening Single File Dialog box...');
|
101
|
+
_singleFileDialogBox.browse([_fileFilter]);
|
102
|
+
// ExternalInterface.call('s3_swf.jsLog','Single File Dialog box Opened');
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
// called after user selected files form the browse dialouge box.
|
107
|
+
private function selectFileHandler(event:Event):void {
|
108
|
+
// ExternalInterface.call('s3_swf.jsLog','selectFileHandler');
|
109
|
+
var remainingSpots:int = _queueSizeLimit - this.queue.length;
|
110
|
+
var tooMany:Boolean = false;
|
111
|
+
|
112
|
+
if(_selectMultipleFiles == true){
|
113
|
+
// Adding multiple files to the queue array
|
114
|
+
// ExternalInterface.call('s3_swf.jsLog','Adding multiple files to the queue array...');
|
115
|
+
if(event.currentTarget.fileList.length > remainingSpots) { tooMany = true; }
|
116
|
+
var i:int;
|
117
|
+
for (i=0;i < remainingSpots; i ++){
|
118
|
+
// ExternalInterface.call('s3_swf.jsLog','Adding '+(i+1)+' of '+(remainingSpots)+' files to the queue array...');
|
119
|
+
addFile(event.currentTarget.fileList[i]);
|
120
|
+
// ExternalInterface.call('s3_swf.jsLog',(i+1)+' of '+(remainingSpots)+' files added to the queue array');
|
121
|
+
}
|
122
|
+
// ExternalInterface.call('s3_swf.jsLog','Multiple files added to the queue array');
|
123
|
+
} else {
|
124
|
+
// Adding one single file to the queue array
|
125
|
+
// ExternalInterface.call('s3_swf.jsLog','Adding single file to the queue array...');
|
126
|
+
if(remainingSpots > 0) {
|
127
|
+
addFile(FileReference(event.target));
|
128
|
+
} else {
|
129
|
+
tooMany = true;
|
130
|
+
}
|
131
|
+
// ExternalInterface.call('s3_swf.jsLog','Single file added to the queue array');
|
132
|
+
}
|
133
|
+
|
134
|
+
if(tooMany == true) {
|
135
|
+
// ExternalInterface.call('s3_swf.jsLog','Calling onQueueSizeLimitReached...');
|
136
|
+
ExternalInterface.call(S3Uploader.s3_swf_obj+'.onQueueSizeLimitReached',this.queue.toJavascript());
|
137
|
+
// ExternalInterface.call('s3_swf.jsLog','onQueueSizeLimitReached called');
|
138
|
+
}
|
139
|
+
|
140
|
+
}
|
141
|
+
|
142
|
+
// Add Selected File to Queue from file browser dialog box
|
143
|
+
private function addFile(file:FileReference):void{
|
144
|
+
// ExternalInterface.call('s3_swf.jsLog','addFile');
|
145
|
+
if(!file) return;
|
146
|
+
if (checkFileSize(file.size)){
|
147
|
+
// ExternalInterface.call('s3_swf.jsLog','Adding file to queue...');
|
148
|
+
this.queue.addItem(file);
|
149
|
+
// ExternalInterface.call('s3_swf.jsLog','File added to queue');
|
150
|
+
// ExternalInterface.call('s3_swf.jsLog','Calling onFileAdd...');
|
151
|
+
ExternalInterface.call(S3Uploader.s3_swf_obj+'.onFileAdd',toJavascript(file));
|
152
|
+
// ExternalInterface.call('s3_swf.jsLog','onFileAdd called');
|
153
|
+
} else {
|
154
|
+
// ExternalInterface.call('s3_swf.jsLog','Calling onFileSizeLimitReached...');
|
155
|
+
ExternalInterface.call(S3Uploader.s3_swf_obj+'.onFileSizeLimitReached',toJavascript(file));
|
156
|
+
// ExternalInterface.call('s3_swf.jsLog','onFileSizeLimitReached called');
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
|
161
|
+
// Remove File From Queue by index number
|
162
|
+
private function removeFileHandler(index:Number):void{
|
163
|
+
try {
|
164
|
+
var del_file:FileReference = FileReference(this.queue.getItemAt(index));
|
165
|
+
this.queue.removeItemAt(index);
|
166
|
+
// ExternalInterface.call('s3_swf.jsLog','Calling onFileRemove...');
|
167
|
+
ExternalInterface.call(S3Uploader.s3_swf_obj+'.onFileRemove',del_file);
|
168
|
+
// ExternalInterface.call('s3_swf.jsLog','onFileRemove called');
|
169
|
+
} catch(e:Error) {
|
170
|
+
// ExternalInterface.call('s3_swf.jsLog','Calling onFileNotInQueue...');
|
171
|
+
ExternalInterface.call(S3Uploader.s3_swf_obj+'.onFileNotInQueue');
|
172
|
+
// ExternalInterface.call('s3_swf.jsLog','onFileNotInQueue called');
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
|
177
|
+
/* MISC */
|
178
|
+
|
179
|
+
// Checks the files do not exceed maxFileSize | if maxFileSize == 0 No File Limit Set
|
180
|
+
private function checkFileSize(filesize:Number):Boolean{
|
181
|
+
var r:Boolean = false;
|
182
|
+
//if filesize greater then maxFileSize
|
183
|
+
if (filesize > _fileSizeLimit){
|
184
|
+
r = false;
|
185
|
+
} else if (filesize <= _fileSizeLimit){
|
186
|
+
r = true;
|
187
|
+
}
|
188
|
+
if (_fileSizeLimit == 0){
|
189
|
+
r = true;
|
190
|
+
}
|
191
|
+
return r;
|
192
|
+
}
|
193
|
+
|
194
|
+
// Turns a FileReference into an Object so that ExternalInterface doesn't choke
|
195
|
+
private function toJavascript(file:FileReference):Object{
|
196
|
+
var javascriptable_file:Object = new Object();
|
197
|
+
javascriptable_file.name = file.name;
|
198
|
+
javascriptable_file.size = file.size;
|
199
|
+
javascriptable_file.type = file.type;
|
200
|
+
return javascriptable_file;
|
201
|
+
}
|
202
|
+
|
203
|
+
}
|
204
|
+
}
|
@@ -0,0 +1,196 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2008, Adobe Systems Incorporated
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are
|
7
|
+
met:
|
8
|
+
|
9
|
+
* Redistributions of source code must retain the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer.
|
11
|
+
|
12
|
+
* Redistributions in binary form must reproduce the above copyright
|
13
|
+
notice, this list of conditions and the following disclaimer in the
|
14
|
+
documentation and/or other materials provided with the distribution.
|
15
|
+
|
16
|
+
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
+
contributors may be used to endorse or promote products derived from
|
18
|
+
this software without specific prior written permission.
|
19
|
+
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*/
|
32
|
+
package com.adobe.net
|
33
|
+
{
|
34
|
+
public class MimeTypeMap
|
35
|
+
{
|
36
|
+
private var types:Array =
|
37
|
+
[["application/andrew-inset","ez"],
|
38
|
+
["application/atom+xml","atom"],
|
39
|
+
["application/mac-binhex40","hqx"],
|
40
|
+
["application/mac-compactpro","cpt"],
|
41
|
+
["application/mathml+xml","mathml"],
|
42
|
+
["application/msword","doc"],
|
43
|
+
["application/octet-stream","bin","dms","lha","lzh","exe","class","so","dll","dmg"],
|
44
|
+
["application/oda","oda"],
|
45
|
+
["application/ogg","ogg"],
|
46
|
+
["application/pdf","pdf"],
|
47
|
+
["application/postscript","ai","eps","ps"],
|
48
|
+
["application/rdf+xml","rdf"],
|
49
|
+
["application/smil","smi","smil"],
|
50
|
+
["application/srgs","gram"],
|
51
|
+
["application/srgs+xml","grxml"],
|
52
|
+
["application/vnd.adobe.apollo-application-installer-package+zip","air"],
|
53
|
+
["application/vnd.mif","mif"],
|
54
|
+
["application/vnd.mozilla.xul+xml","xul"],
|
55
|
+
["application/vnd.ms-excel","xls"],
|
56
|
+
["application/vnd.ms-powerpoint","ppt"],
|
57
|
+
["application/vnd.rn-realmedia","rm"],
|
58
|
+
["application/vnd.wap.wbxml","wbxml"],
|
59
|
+
["application/vnd.wap.wmlc","wmlc"],
|
60
|
+
["application/vnd.wap.wmlscriptc","wmlsc"],
|
61
|
+
["application/voicexml+xml","vxml"],
|
62
|
+
["application/x-bcpio","bcpio"],
|
63
|
+
["application/x-cdlink","vcd"],
|
64
|
+
["application/x-chess-pgn","pgn"],
|
65
|
+
["application/x-cpio","cpio"],
|
66
|
+
["application/x-csh","csh"],
|
67
|
+
["application/x-director","dcr","dir","dxr"],
|
68
|
+
["application/x-dvi","dvi"],
|
69
|
+
["application/x-futuresplash","spl"],
|
70
|
+
["application/x-gtar","gtar"],
|
71
|
+
["application/x-hdf","hdf"],
|
72
|
+
["application/x-javascript","js"],
|
73
|
+
["application/x-koan","skp","skd","skt","skm"],
|
74
|
+
["application/x-latex","latex"],
|
75
|
+
["application/x-netcdf","nc","cdf"],
|
76
|
+
["application/x-sh","sh"],
|
77
|
+
["application/x-shar","shar"],
|
78
|
+
["application/x-shockwave-flash","swf"],
|
79
|
+
["application/x-stuffit","sit"],
|
80
|
+
["application/x-sv4cpio","sv4cpio"],
|
81
|
+
["application/x-sv4crc","sv4crc"],
|
82
|
+
["application/x-tar","tar"],
|
83
|
+
["application/x-tcl","tcl"],
|
84
|
+
["application/x-tex","tex"],
|
85
|
+
["application/x-texinfo","texinfo","texi"],
|
86
|
+
["application/x-troff","t","tr","roff"],
|
87
|
+
["application/x-troff-man","man"],
|
88
|
+
["application/x-troff-me","me"],
|
89
|
+
["application/x-troff-ms","ms"],
|
90
|
+
["application/x-ustar","ustar"],
|
91
|
+
["application/x-wais-source","src"],
|
92
|
+
["application/xhtml+xml","xhtml","xht"],
|
93
|
+
["application/xml","xml","xsl"],
|
94
|
+
["application/xml-dtd","dtd"],
|
95
|
+
["application/xslt+xml","xslt"],
|
96
|
+
["application/zip","zip"],
|
97
|
+
["audio/basic","au","snd"],
|
98
|
+
["audio/midi","mid","midi","kar"],
|
99
|
+
["audio/mpeg","mp3","mpga","mp2"],
|
100
|
+
["audio/x-aiff","aif","aiff","aifc"],
|
101
|
+
["audio/x-mpegurl","m3u"],
|
102
|
+
["audio/x-pn-realaudio","ram","ra"],
|
103
|
+
["audio/x-wav","wav"],
|
104
|
+
["chemical/x-pdb","pdb"],
|
105
|
+
["chemical/x-xyz","xyz"],
|
106
|
+
["image/bmp","bmp"],
|
107
|
+
["image/cgm","cgm"],
|
108
|
+
["image/gif","gif"],
|
109
|
+
["image/ief","ief"],
|
110
|
+
["image/jpeg","jpg","jpeg","jpe"],
|
111
|
+
["image/png","png"],
|
112
|
+
["image/svg+xml","svg"],
|
113
|
+
["image/tiff","tiff","tif"],
|
114
|
+
["image/vnd.djvu","djvu","djv"],
|
115
|
+
["image/vnd.wap.wbmp","wbmp"],
|
116
|
+
["image/x-cmu-raster","ras"],
|
117
|
+
["image/x-icon","ico"],
|
118
|
+
["image/x-portable-anymap","pnm"],
|
119
|
+
["image/x-portable-bitmap","pbm"],
|
120
|
+
["image/x-portable-graymap","pgm"],
|
121
|
+
["image/x-portable-pixmap","ppm"],
|
122
|
+
["image/x-rgb","rgb"],
|
123
|
+
["image/x-xbitmap","xbm"],
|
124
|
+
["image/x-xpixmap","xpm"],
|
125
|
+
["image/x-xwindowdump","xwd"],
|
126
|
+
["model/iges","igs","iges"],
|
127
|
+
["model/mesh","msh","mesh","silo"],
|
128
|
+
["model/vrml","wrl","vrml"],
|
129
|
+
["text/calendar","ics","ifb"],
|
130
|
+
["text/css","css"],
|
131
|
+
["text/html","html","htm"],
|
132
|
+
["text/plain","txt","asc"],
|
133
|
+
["text/richtext","rtx"],
|
134
|
+
["text/rtf","rtf"],
|
135
|
+
["text/sgml","sgml","sgm"],
|
136
|
+
["text/tab-separated-values","tsv"],
|
137
|
+
["text/vnd.wap.wml","wml"],
|
138
|
+
["text/vnd.wap.wmlscript","wmls"],
|
139
|
+
["text/x-setext","etx"],
|
140
|
+
["video/mpeg","mpg","mpeg","mpe"],
|
141
|
+
["video/quicktime","mov","qt"],
|
142
|
+
["video/vnd.mpegurl","m4u","mxu"],
|
143
|
+
["video/x-flv","flv"],
|
144
|
+
["video/x-msvideo","avi"],
|
145
|
+
["video/x-sgi-movie","movie"],
|
146
|
+
["x-conference/x-cooltalk","ice"]];
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Returns the mimetype for the given extension.
|
150
|
+
*/
|
151
|
+
public function getMimeType(extension:String):String
|
152
|
+
{
|
153
|
+
extension = extension.toLocaleLowerCase();
|
154
|
+
for each (var a:Array in types)
|
155
|
+
{
|
156
|
+
for each (var b:String in a)
|
157
|
+
{
|
158
|
+
if (b == extension)
|
159
|
+
{
|
160
|
+
return a[0];
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
return null;
|
165
|
+
}
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Returns the prefered extension for the given mimetype.
|
169
|
+
*/
|
170
|
+
public function getExtension(mimetype:String):String
|
171
|
+
{
|
172
|
+
mimetype = mimetype.toLocaleLowerCase();
|
173
|
+
for each (var a:Array in types)
|
174
|
+
{
|
175
|
+
if (a[0] == mimetype)
|
176
|
+
{
|
177
|
+
return a[1];
|
178
|
+
}
|
179
|
+
}
|
180
|
+
return null;
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Adds a mimetype to the map. The order of the extensions matters. The most preferred should come first.
|
185
|
+
*/
|
186
|
+
public function addMimeType(mimetype:String, extensions:Array):void
|
187
|
+
{
|
188
|
+
var newType:Array = [mimetype];
|
189
|
+
for each (var a:String in extensions)
|
190
|
+
{
|
191
|
+
newType.push(a);
|
192
|
+
}
|
193
|
+
types.push(newType);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
package com.elctech {
|
2
|
+
public class S3UploadOptions {
|
3
|
+
/**
|
4
|
+
* Options specified at:
|
5
|
+
* http://docs.amazonwebservices.com/AmazonS3/2006-03-01/HTTPPOSTForms.html
|
6
|
+
*/
|
7
|
+
public var AWSAccessKeyId:String;
|
8
|
+
public var acl:String;
|
9
|
+
public var bucket:String;
|
10
|
+
public var CacheControl:String;
|
11
|
+
public var ContentType:String;
|
12
|
+
public var ContentDisposition:String;
|
13
|
+
public var ContentEncoding:String;
|
14
|
+
public var Expires:String;
|
15
|
+
public var key:String;
|
16
|
+
public var policy:String;
|
17
|
+
public var successactionredirect:String;
|
18
|
+
public var redirect:String;
|
19
|
+
public var successactionstatus:String;
|
20
|
+
public var signature:String;
|
21
|
+
public var xamzsecuritytoken:String;
|
22
|
+
public var file:String;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Addition field
|
26
|
+
*/
|
27
|
+
public var Secure:String; /* A flag indicating whether HTTPS should be used. */
|
28
|
+
public var FileName:String;
|
29
|
+
public var FileSize:String;
|
30
|
+
}
|
31
|
+
}
|