🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1734

Re: HTTP put problem

#1734
From: Remy Lebeau (TeamB)
Date: Thu, 02 Nov 2006 17:35
43 lines
2273 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:4549daf0$1@newsgroups.borland.com...

> I'm not sure how to use multipart/form-data. Do you think
> you could give me a few tips, please?

I already told you how to use it in your code - use the
TIdMultipartFormDataStream with the TIdHTTP::Post() method.

As far as the server is concerned, do any pages on your website have a
fillout form with a File button on it?  If so, then you can submit the
TIdMultipartFormDataStream to the same URL that the form is submitted to.
In other words, if you have the following HTML:

    <form method="Post" action="myscript.asp" enctype="multipart/form-data">
    Select a file to upload: <input type="file" name="myfile"> <input
type="submit">
    </form>

Then the code would look like this:

    try
    {
        TIdMultipartFormDataStream *Strm = new TIdMultipartFormDataStream;
        try
        {
            Strm->AddFile("myfile", acPath, "");
            IdHTTP1->Post("http://www.MySite.co.uk/myscript.asp", Strm);
        }
        __finally
        {
            delete SL;
        }
        ListBox1->Items->Add("File sent");
    }
    catch(const Exception &)
    {
        return;
    }


Gambit
Technical Details
Message-ID: <454a2cd8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45488c35@newsgroups.borland.com> <454912a4@newsgroups.borland.com> <4549baa0$1@newsgroups.borland.com> <4549c41e$1@newsgroups.borland.com> <4549daf0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4411f87e3d41fa3f
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <45488c35@newsgroups.borland.com> <454912a4@newsgroups.borland.com> <4549baa0$1@newsgroups.borland.com> <4549c41e$1@newsgroups.borland.com> <4549daf0$1@newsgroups.borland.com>
Subject: Re: HTTP put problem
Date: Thu, 2 Nov 2006 09:35:13 -0800
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 69.169.4.232
Message-ID: <454a2cd8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1162489048 69.169.4.232 (2 Nov 2006 09:37:28 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail