Hi, I need to take a base64 encoded image file and ftp it to a server. The following code works fine with ASCII data, but doesn't upload anything (or cause any errors) with the image. Am I missing something obvious here? Any ideas?
--- var targetURI = "ftp://id:[EMAIL PROTECTED]"; //decode base64 encoding var data = window.atob(base64input); // create stream listener var StreamListener = { onStartRequest : function(request, context) {}, onStopRequest : function(request, context, statusCode) { alert('End: '+ statusCode); }, onDataAvailable : function(request, context, inputStream, offset, count) { } }; // create upload channel var io = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var UploadURI = io.newURI(targetURI, null, null); var UploadChannel = io.newChannelFromURI(UploadURI).QueryInterface(Components.interfaces.nsIUploadChannel); // create stream var aStream = Components.classes['@mozilla.org/io/string-input-stream;1'] .createInstance(Components.interfaces.nsIStringInputStream); aStream.setData(data, -1); //upload the file UploadChannel.setUploadStream(aStream, null, -1); UploadChannel.asyncOpen(StreamListener, null); --- Thanks, Dan _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
