 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Yehia A.Salam Guest
|
Posted: Sun Feb 12, 2006 10:03 pm Post subject: Upload using Indy |
|
|
Hello,
i need to validate a css file automatically using indy components, i need to
upload it first and then get the results, i can do it manually from this
link:
http://jigsaw.w3.org/css-validator/validator-upload
but i want to do it automatically using indy. And as i hardly know what POST
and GET means, i would appreciate some help.
Thanks
Yehia |
|
| Back to top |
|
 |
Don Guest
|
Posted: Mon Feb 13, 2006 8:03 am Post subject: Re: Upload using Indy |
|
|
| Quote: | i need to validate a css file automatically using indy components, i need
to upload it first and then get the results, i can do it manually from
this link:
http://jigsaw.w3.org/css-validator/validator-upload
but i want to do it automatically using indy. And as i hardly know what
POST and GET means, i would appreciate some help.
|
The form at that page uses multipart/form data. You need to create a data
stream that mimicks the input fields on the page, and post it to the web
page indicated in the Action for the input form.
Indy has a multipart form component that makes this process easier. For
example:
// uses IdMultipartFormData;
// var MPData: TIdMultiPartFormDataStream;
// var sResponse: string;
MPData := TIdMultiPartFormDataStream.Create;
MPData.AddFile('file', 'c:\temp\Test.css', 'text/css');
MPData.AddFormField('warning', '2');
MPData.AddFormField('profile', 'css2');
MPData.AddFormField('usermedium', 'all');
sResponse := IdHTTP1.Post('http://jigsaw.w3.org/css-validator/validator',
MPData);
MPData.Free;
// do something with the content in sResponse...
hth... |
|
| Back to top |
|
 |
Yehia A.Salam Guest
|
Posted: Mon Feb 13, 2006 5:03 pm Post subject: Re: Upload using Indy |
|
|
THANKS
"Don" <blacknapkin (AT) twistandfruge (DOT) com> wrote in message
news:43f032b2$1 (AT) newsgroups (DOT) borland.com...
| Quote: | i need to validate a css file automatically using indy components, i need
to upload it first and then get the results, i can do it manually from
this link:
http://jigsaw.w3.org/css-validator/validator-upload
but i want to do it automatically using indy. And as i hardly know what
POST and GET means, i would appreciate some help.
The form at that page uses multipart/form data. You need to create a data
stream that mimicks the input fields on the page, and post it to the web
page indicated in the Action for the input form.
Indy has a multipart form component that makes this process easier. For
example:
// uses IdMultipartFormData;
// var MPData: TIdMultiPartFormDataStream;
// var sResponse: string;
MPData := TIdMultiPartFormDataStream.Create;
MPData.AddFile('file', 'c:\temp\Test.css', 'text/css');
MPData.AddFormField('warning', '2');
MPData.AddFormField('profile', 'css2');
MPData.AddFormField('usermedium', 'all');
sResponse := IdHTTP1.Post('http://jigsaw.w3.org/css-validator/validator',
MPData);
MPData.Free;
// do something with the content in sResponse...
hth...
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|