H
hmFeng
Unregistered / Unconfirmed
GUEST, unregistred user!
我用xmlhttp发送一个"PUT"的请求到Share Point 的Web Storage System中上传文件,
文本文件已经成功,但是一些非文本文件读出来的时乱码,请请教!
My Code:
function putfile()
{
var fso,f;
try
{
fso = new ActiveXObject("Scripting.FileSystemObject");
}
catch(e)
{
alert("不能创建ActiveX对象,请检查浏览器设置!");
return false;
}
try
{
f = fso.GetFile(fileurl);
}
catch(e)
{
alert("此文件不存在!");
fso = null;
return false;
}
var oStream = f.OpenAsTextStream(1,0)
var textStream = oStream.ReadAll();
var objXMLHttp = new ActiveXObject("microsoft.xmlhttp");
objXMLHttp.Open("PUT","http://servername/workspacename/documents/text.doc",false)
objXMLHttp.setRequestHeader("Translate","f")
objXMLHttp.setRequestHeader("Content-type","text/plain");
objXMLHttp.send(textStream);
alert(objXMLHttp.statusText);
objXMLHttp = null;
}
文本文件已经成功,但是一些非文本文件读出来的时乱码,请请教!
My Code:
function putfile()
{
var fso,f;
try
{
fso = new ActiveXObject("Scripting.FileSystemObject");
}
catch(e)
{
alert("不能创建ActiveX对象,请检查浏览器设置!");
return false;
}
try
{
f = fso.GetFile(fileurl);
}
catch(e)
{
alert("此文件不存在!");
fso = null;
return false;
}
var oStream = f.OpenAsTextStream(1,0)
var textStream = oStream.ReadAll();
var objXMLHttp = new ActiveXObject("microsoft.xmlhttp");
objXMLHttp.Open("PUT","http://servername/workspacename/documents/text.doc",false)
objXMLHttp.setRequestHeader("Translate","f")
objXMLHttp.setRequestHeader("Content-type","text/plain");
objXMLHttp.send(textStream);
alert(objXMLHttp.statusText);
objXMLHttp = null;
}