Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Uploading File Using Delphi To A Php Upload Script, delphi 6 would be prefered
oncombeureum
post May 24 2005, 02:03 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 28
Joined: 17-April 05
Member No.: 4,081



simple question:

how to upload files using delphi, using http protokol that will be received by php script ?

ex:
delphi ---------------> www.giveittome.com/whereisit.php


thanks

Oncom Beureum

This post has been edited by microscopic^earthling: Nov 3 2005, 05:25 PM
Go to the top of the page
 
+Quote Post
fabiocardoso
post Aug 14 2005, 10:07 AM
Post #2


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 25
Joined: 7-August 05
Member No.: 7,682



I do not know if it it can be useful, but delphi includes some examples in the diretorio demo. I know that it has an example using ftp.

Good luck!
Go to the top of the page
 
+Quote Post
Digital Technic
post Nov 3 2005, 05:05 PM
Post #3


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 9
Joined: 3-November 05
Member No.: 9,422



QUOTE(oncombeureum @ May 23 2005, 10:03 PM)
simple question:

how to upload files using delphi, using http protokol that will be received by php script ?

ex:
delphi ---------------> www.giveittome.com/whereisit.php
thanks

Oncom Beureum
*



You can do this using Indy that comes with Delphi. It involves two things. TIdHTTP and TIdMultipartFormDataStream.

Add IdMultipartFormData to your uses clause. Drop TIdHTTP (which is in Indy Clients tab of Component Palette ) on to your form. Set whatever properties of TIdHTTP you want. Now if you were wanting the file to be uploaded after a button has been clicked then put this in the event handler you assigned for the buttons OnClick event.

CODE

procedure TFormClassNameHere.EventHandlerNameHere( Sender : TObject )
var
 Stream            : TIdMultipartFormDataStream;
begin
 Stream := TIdMultipartFormDataStream.Create;
 try
   Stream.AddFile( 'form_field_name_here', 'filename_here', 'content-type_here' );
   IdHTTP1.Post( 'url_here', Stream );
 finally
   Stream.Free;
 end;
end;


That's basically it. If you have any questions then please feel free to ask. I'm quite proficient in Delphi.

Regards, Digital Technic.

p.s. If you need an example to be attached I could provide that too.
Go to the top of the page
 
+Quote Post
arxaan
post Dec 15 2006, 08:34 AM
Post #4


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 1
Joined: 15-December 06
Member No.: 18,352



[quote name='Digital Technic' date='Nov 3 2005, 10:35 PM' post='59255']
You can do this using Indy that comes with Delphi. It involves two things. TIdHTTP and TIdMultipartFormDataStream.

yeah, but what if im making a ASP.NET app, cant use Indy ,can I ? then how do I select the file to upload since it doesnt provide dialog box compomnents.

Thanx,
Aryan
Go to the top of the page
 
+Quote Post
iGuest
post Feb 12 2008, 03:59 AM
Post #5


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



example
Uploading File Using Delphi To A Php Upload Script

Replying to Digital Technic



Can you give me an example with it,



-wowok
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Resources For Beginner Delphi Programmer ?(11)
  2. Help: Change Language On Fly With Delphi(3)
  3. Can Delphi Be Used For Distributed Appz?(1)
  4. Keyboard Simulation(3)
  5. Delphi 6 And XP(2)
  6. Hide Delphi's Splash Screen - Delphi 6(0)


 



- Lo-Fi Version Time is now: 6th September 2008 - 08:16 PM