Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Automated file upload Delphi -> ASP help needed

Posted on 2004-09-07
Medium Priority
Last Modified: 2012-05-05
I have example, but it does not work with ASP. I did get this code to write some data, like :
 'file one content. Contant-Type can be application/octet-stream or if '+
  'you want you can ask your OS fot the exact type.
Unfortunately it can't upload new files. Server side must be ASP.

//Delphi procedure:
procedure TForm1.Button2Click(Sender: TObject);
Const CRLF = #13#10;
Var aStream: TMemoryStream;
      Params: TMemoryStream;
      S: String;
 aStream := TMemoryStream.create;
 Params := TMemoryStream.Create;
 HTTP.Request.ContentType := 'multipart/form-data; boundary=-----------------------------7cf87224d2020a';
  S := '-----------------------------7cf87224d2020a' + CRLF +
  'Content-Disposition: form-data; name="csv"; filename="d:abc.csv"' + CRLF +
  'Content-Type: text/plain' + CRLF + CRLF +
  'file one content. Contant-Type can be application/octet-stream or if '+
  'you want you can ask your OS fot the exact type.' + CRLF +
  '-----------------------------7cf87224d2020a' + CRLF +
  'Content-Disposition: form-data; name="game_number"' + CRLF + CRLF + 'hello2' + CRLF +
 Params.Write(S[1], Length(S));
 with HTTP do begin
  HTTP.Post('', Params, aStream);
 on E: Exception do
 showmessage('Error encountered during POST: ' + E.Message);
aStream.WriteBuffer(#0' ', 1);

is there simplier example?
Question by:Povilas
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 11997190
I found this example that works:
LVL 26

Expert Comment

ID: 12010331
First off, I don't see where you are loading the file into your stream at all.
I'd suggest looking at Shiv Kumar's Upload tutorial here:

Accepted Solution

modulo earned 0 total points
ID: 13432771
PAQed with points refunded (125)

Community Support Moderator

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question