jsp页面有一个input框,类型是file,我现在想用delphi调用这个jsp页面,并且给input赋值,就是我的本地文件路径,然后执行submit,完成文件上传。如何实现??

解决方案 »

  1.   

    你可以直接使用ihtml里的东西啊  使用ihtmlinputdocument来传输数据
      

  2.   

    使用xmlhttp不可以吗?楼主试了没有
      

  3.   

    input框,类型是file 这个是只读的,不可以赋值吧
      

  4.   

    很简单啊。。你想通过DELPHI提交一个文件位置的字符串给JSP页面,然后JSP页面能找到这个文件并上传吧?!用IdHTTP控件就轻松搞定
    var
       sParams: TStringStream;      sParams := TStringStream.create('');
          IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
          try
              try
                sParams.WriteString("c:\a.txt") ;
                strGetMsg:=IdHTTP1.post("http://www.163.com/get.jsp",sParams) ;
                strGetMsg := Trim(strGetMsg);
                if(strGetMsg ='ok') then
                begin
                    memo1.Lines.Add(strGetMsg);
                    memo1.Lines.Add('Send Success'+DateTimeToStr(Now));            end
                else begin
                    memo1.Lines.Add(strGetMsg);
                    memo1.Lines.Add('发送失败.'+DateTimeToStr(Now));
                end;
              finally
                sParams.Free ;
              end;
          except
            memo1.Lines.Add('发送失败,请确保网络.'+DateTimeToStr(Now));
          end;