X
xmc404
Unregistered / Unconfirmed
GUEST, unregistred user!
上传图片后,图片打开,高手们来帮我看看 procedure TForm1.Button3Click(Sender: TObject); var response: TStringStream; MMPFDS: TIdMultiPartFormDataStream; idhttp1: TIDhttp; begin if OpenDialog1.Execute then begin MMPFDS := TIdMultiPartFormDataStream.Create; response := TStringStream.Create(''); idhttp1 := TIDhttp.Create(nil); MMPFDS.AddFile('file1', OpenDialog1.FileName, 'multipart/form-data'); // idhttp1.Request.ContentType := MMPFDS.RequestContentType; MMPFDS.Position := 0; try idhttp1.Post('http://10.11.18.3/Upload/SoftUpload.asp', MMPFDS, response); finally showMessage(response.DataString); MMPFDS.Free; response.Free; idhttp1.Disconnect; idhttp1.Free; end; end; end; ----------------------------- ASP: <% bFileData=Request.BinaryRead(Request.TotalBytes) ' 创建 Stream 对象 set ado_stream = Server.CreateObject("ADODB.Stream") ' 打开Stream对象,把数据存入其中 ado_stream.Type = 1 ' 1=adTypeBinary ado_stream.open ado_stream.Write bFileData ' 文件存盘 ado_stream.SaveToFile Server.MapPath("a.jpg"),2 ' 2=adSaveCreateOverWrite ado_stream.close ' 销毁对象 set ado_stream = Nothing ' 向浏览器返回信息 if -2147221005 <> Err then Response.Write "ok" else Response.Write "Err" & chr(13) Response.Write Err.Number & ":" & Err.Description end if %>