summaryrefslogtreecommitdiff
path: root/webcam/com/marstonstudio/UploadPostHelper.as
diff options
context:
space:
mode:
authortimb <timb@mb.local>2010-02-11 03:54:41 -0800
committertimb <timb@mb.local>2010-02-11 03:54:41 -0800
commitc6c120b9aa3b081fc9724f083b72bfc7f83ebce7 (patch)
tree7f32faf9425a2b23da92240436da903eadc96df3 /webcam/com/marstonstudio/UploadPostHelper.as
parent3352b2dfdf82955d58fca2dd08e4a4d5fc289c93 (diff)
enabled webcam upload\!
Diffstat (limited to 'webcam/com/marstonstudio/UploadPostHelper.as')
-rw-r--r--webcam/com/marstonstudio/UploadPostHelper.as21
1 files changed, 12 insertions, 9 deletions
diff --git a/webcam/com/marstonstudio/UploadPostHelper.as b/webcam/com/marstonstudio/UploadPostHelper.as
index 857bc42..43eb429 100644
--- a/webcam/com/marstonstudio/UploadPostHelper.as
+++ b/webcam/com/marstonstudio/UploadPostHelper.as
@@ -36,7 +36,7 @@ package com.marstonstudio
public static function getBoundary():String {
if(_boundary.length == 0) {
- for (var i:int = 0; i &lt; 0x20; i++ ) {
+ for (var i:int = 0; i < 0x20; i++ ) {
_boundary += String.fromCharCode( int( 97 + Math.random() * 25 ) );
}
}
@@ -66,7 +66,7 @@ package com.marstonstudio
postData = BOUNDARY(postData);
postData = LINEBREAK(postData);
bytes = 'Content-Disposition: form-data; name="' + name + '"';
- for ( i = 0; i &lt; bytes.length; i++ ) {
+ for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
@@ -78,15 +78,15 @@ package com.marstonstudio
//add Filedata to postData
postData = BOUNDARY(postData);
postData = LINEBREAK(postData);
- bytes = 'Content-Disposition: form-data; name="Filedata"; filename="';
- for ( i = 0; i &lt; bytes.length; i++ ) {
+ bytes = 'Content-Disposition: form-data; name="image"; filename="';
+ for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData.writeUTFBytes(fileName);
postData = QUOTATIONMARK(postData);
postData = LINEBREAK(postData);
- bytes = 'Content-Type: application/octet-stream';
- for ( i = 0; i &lt; bytes.length; i++ ) {
+ bytes = 'Content-Type: image/jpeg';
+ for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
@@ -94,21 +94,24 @@ package com.marstonstudio
postData.writeBytes(byteArray, 0, byteArray.length);
postData = LINEBREAK(postData);
+ // timb: i commented this shit out because i don't think it's needed
//add upload filed to postData
+ /*
postData = LINEBREAK(postData);
postData = BOUNDARY(postData);
postData = LINEBREAK(postData);
bytes = 'Content-Disposition: form-data; name="Upload"';
- for ( i = 0; i &lt; bytes.length; i++ ) {
+ for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
postData = LINEBREAK(postData);
bytes = 'Submit Query';
- for ( i = 0; i &lt; bytes.length; i++ ) {
+ for ( i = 0; i < bytes.length; i++ ) {
postData.writeByte( bytes.charCodeAt(i) );
}
postData = LINEBREAK(postData);
+ */
//closing boundary
postData = BOUNDARY(postData);
@@ -124,7 +127,7 @@ package com.marstonstudio
var l:int = UploadPostHelper.getBoundary().length;
p = DOUBLEDASH(p);
- for (var i:int = 0; i &lt; l; i++ ) {
+ for (var i:int = 0; i < l; i++ ) {
p.writeByte( _boundary.charCodeAt( i ) );
}
return p;