diff options
Diffstat (limited to 'webcam/com/marstonstudio/UploadPostHelper.as')
| -rw-r--r-- | webcam/com/marstonstudio/UploadPostHelper.as | 21 |
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 < 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 < 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 < 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 < 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 < 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 < 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 < l; i++ ) { + for (var i:int = 0; i < l; i++ ) { p.writeByte( _boundary.charCodeAt( i ) ); } return p; |
