BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Upload using Indy

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Yehia A.Salam
Guest





PostPosted: Sun Feb 12, 2006 10:03 pm    Post subject: Upload using Indy Reply with quote



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





PostPosted: Mon Feb 13, 2006 8:03 am    Post subject: Re: Upload using Indy Reply with quote



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





PostPosted: Mon Feb 13, 2006 5:03 pm    Post subject: Re: Upload using Indy Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.