Hello all,
I’m tying to upload a file to my server, for a project due by EOP today 0_o… I’m stuck on the ServerSide code though…
I think it’s the ASP code that I’ve got wrong… Has anyone got some examples? I’m sure I’ve seen some on the Net, but I can’t seem to find anything at the moment…
Thanks
Here is my AS3 Code
var ba:ByteArray = e.currentTarget.data as ByteArray;
var baURLRequest:URLRequest = new URLRequest("http://www.severadd.com/toolkit/app/scripts/saveByteArray.asp");
baURLRequest.requestHeaders.push(new URLRequestHeader("Content-type", "application/octet-stream"));
baURLRequest.method = URLRequestMethod.POST;
//Add jpg byte array to URL request
var vars:URLVariables = new URLVariables();
vars.byteArray = ba
baURLRequest.data = vars;
//Get the URLLoader ready
var sendBALoader:URLLoader = new URLLoader(baURLRequest);
sendBALoader.dataFormat = URLLoaderDataFormat.BINARY;
sendBALoader.addEventListener(Event.COMPLETE, onHTTPComplete);
sendBALoader.load(baURLRequest)
ASP CODE
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
FileName = "C:\Home\a\r oolkit\app\uploads\WNS Channel Partner\PartnerEmpower_Framework_Overview_for_Partners_v3_021211.ppt"'Request("filaname")
ByteArray = Request("ba")
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save binary data.
BinaryStream.Type = adTypeBinary
'Open the stream And write binary data To the object
BinaryStream.Open
BinaryStream.Write ByteArray
'Save binary data To disk
BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
%>