Automated file upload Delphi -> ASP help needed

Posted on 2004-09-07
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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IExtractImage Delphi 14 207
IdTelnet1DataAvailable handler freezes the Application 4 68
Downloading email attachments 2 67
can't find the executable in Simulator 1 80
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: (…

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now