怎么做到上传一个文件夹里的所有文件?

桃花源土著 2003-10-21 09:11:49
现在客户有一需求,需要在网页上选择一个文件夹里就将该文件夹下的所有文件上传到DOMINO服务器,不知道哪位高人做过,说一下思路和方法!
...全文
129 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoyuer0851 2003-10-22
  • 打赏
  • 举报
回复
学习ing …………

谢谢楼上的俩位指点…………
donyoung 2003-10-21
  • 打赏
  • 举报
回复
我曾采用的是Applet+Servlet来完成这个操作,原理都是一样的,服务器端的程序负责往文档里添加附件,客户端的负责将用户选择的文件传给服务器端的Servlet程序
gjd111686 2003-10-21
  • 打赏
  • 举报
回复
CGI.jsp是我服务器上的处理程序.你可以替换为Domino的URL[比如Java代理]在Java代理中对服务器接收到的流进行拆分就可以了
gjd111686 2003-10-21
  • 打赏
  • 举报
回复
需要你自己做一个ActiveX来替换<input type="file">
基本上可以用CHttpFile来实现
CInternetSession m_Session("DigitalTitan");
CHttpConnection* pServer=NULL;
CHttpFile* pFile=NULL;
CString strServerName="10.70.151.253";
INTERNET_PORT nPort=9000;
CString strURL="/CGI.jsp";
try
{
pServer=m_Session.GetHttpConnection(strServerName,nPort);
pFile=pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST,strURL,NULL,1,NULL,NULL,INTERNET_FLAG_EXISTING_CONNECT);

pFile->AddRequestHeaders("Content-Type: multipart/form-data");
pFile->AddRequestHeaders("Accept: */*");
CString strBoundary="-----------------------------7d33a816d302b6";//分界线视CGI程序做响应改动.
CString strBuf="";

//构造表单开始
FieldStruct* pFieldStruct=new FieldStruct;
POSITION CurrentPosition;
CString strTemp;
for(int iIndex=0;iIndex<m_FieldData.GetCount();iIndex++)
{
CurrentPosition=m_FieldData.FindIndex(iIndex);
pFieldStruct=(FieldStruct*)m_FieldData.GetAt(CurrentPosition);
strBuf+="--"+strBoundary+"\r\n";
strTemp.Format("Content-Disposition: form-data;name=\"%s\"\r\n\r\n%s\r\n",pFieldStruct->m_FieldName,pFieldStruct->m_FieldValue);
strBuf+=strTemp;
strBuf+="--"+strBoundary+"\r\n";
}
//构造表单结束

strBuf+="--"+strBoundary+"\r\n";
//
CStdioFile m_File;
BYTE pFileBuf[1024];
CString strFileBuf,strFileBuf_;
strFileBuf="";strFileBuf_="";
DWORD dwRead;
if(m_File.Open(strTempDocPath,CFile::modeRead|CFile::typeBinary))
{
do
{
dwRead=m_File.Read(pFileBuf,1024);
strFileBuf_.Format("%s",(char*)pFileBuf);//文件长度是否被我改变???
strFileBuf=strFileBuf+strFileBuf_;
}
while(dwRead>0);
m_File.Close();
}
strTemp.Format("Content-Disposition: form-data;name=\"%s\"\r\n\r\nfilename=\"%s\"\r\n%s","FieldName","FileName",strFileBuf);//构造文件
strBuf+=strTemp;
strBuf+="--"+strBoundary+"--\r\n";
char* pBuf=new char[strBuf.GetLength()];
sprintf(pBuf,"%s",strBuf);
pFile->SendRequest(NULL,0,pBuf,strlen(pBuf));
delete pBuf;
pFile->Close();
pServer->Close();
//AfxMessageBox("UpLoad...",MB_ICONINFORMATION);
}
catch(CInternetException * e)
{
AfxMessageBox("...",MB_ICONINFORMATION);
};
delete pFile;
delete pServer;
m_Session.Close();

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧