using HBTIP

563 views
Skip to first unread message

gtv625

unread,
Mar 8, 2013, 4:31:15 PM3/8/13
to harbou...@googlegroups.com
i need to upload, download and delete some files on my website using ftp protocol. using \contrib\hbtip\upld_ftp.prg i am able only to access root of my webpage. in this example when i set  cServer   := "dvai.net/test" the response is that the file is uploaded but is always uploaded to the root. also is there a way to create subfolders on  website?

Klas Engwall

unread,
Mar 9, 2013, 1:21:51 PM3/9/13
to harbou...@googlegroups.com
Hi gtv625,

> i need to upload, download and delete some files on my website using ftp
> protocol. using \contrib\hbtip\upld_ftp.prg i am able only to access
> root of my webpage. in this example when i set cServer :=
> "dvai.net/test" the response is that the file is uploaded but is always
> uploaded to the root.

Try splitting it in two separate parts, oUrl:cServer and oUrl:cPath,
optionally changing directory manually with the Cwd() method.

> also is there a way to create subfolders on website?

Yes, there is an Mkd() method in tIPClientFtp. For a complete list of
methods, check out contrib\hbtip\ftpcli.prg

Regards,
Klas

Amos

unread,
Mar 10, 2013, 4:53:06 AM3/10/13
to harbou...@googlegroups.com
I have not used ipld_ftp.prg, but I suspect you willhave to connect to "dvai.net" and then change to the directory "test" by issuing the FTP command "CWD test"

gtv625

unread,
Mar 11, 2013, 6:23:53 AM3/11/13
to harbou...@googlegroups.com
somehow in my installation folder \contrib\hbtip was empty, only i saw examples in \contrib\hbtip\tests. should i use content from
https://github.com/vszakats/harbour/blob/master/contrib/hbtip/ftpcli.prg

thanks to all
regards
vanja

Klas Engwall

unread,
Mar 11, 2013, 6:42:30 AM3/11/13
to harbou...@googlegroups.com
Hi Vanja,

> somehow in my installation folder \contrib\hbtip was empty, only i saw
> examples in \contrib\hbtip\tests. should i use content from
>
> https://github.com/vszakats/harbour/blob/master/contrib/hbtip/ftpcli.prg

Official sources and binaries, nightly and stable, are here:

http://sourceforge.net/projects/harbour-project/files/

Regards,
Klas

gtv625

unread,
Mar 11, 2013, 9:37:28 AM3/11/13
to harbou...@googlegroups.com
in \contrib\hbtip i still have only hbtip.hbc and hbtipssl.hbc. am i  right when think that the prgs that should be in this folder are producing libraries  libhbtip.a and libhbtipssl.a. those libraries are allrady in \lib folder. if this is ok i still don't know how to implement Cwd() .and. Mkd()

Klas Engwall

unread,
Mar 11, 2013, 7:09:19 PM3/11/13
to harbou...@googlegroups.com
Hi gtv625,

> in \contrib\hbtip i still have only hbtip.hbc and hbtipssl.hbc. am i
> right when think that the prgs that should be in this folder are
> producing libraries libhbtip.a and libhbtipssl.a. those libraries are
> allrady in \lib folder. if this is ok i still don't know how to
> implement Cwd() .and. Mkd()

I suspect that you do not have the Harbour sources at all but only the
binaries. The sources are in a separate download from a separate page
under the page I mentioned last time. Sources are not strictly necessary
for application programmers but can be a big help when trying to
understand how things are supposed to work.

Are you using Harbour 3.0.0? hbtipssl.hbc was removed last July, about
a year after 3.0.0. was released, so current downloads do not have it.
If you do, download the 3.0.0 sources to match your binaries or
otherwise the nightly sources.

Using Cwd() is optional, as I said before. I usually set up the oUrl
object and the oFtp object like this:

oUrl := tUrl():New()
oUrl:cProto := "ftp"
oUrl:cServer := "thenameoftheserver"
oUrl:cPath := "theremotepath" // Will trigger Cwd() if set
oUrl:cFile := "theremotefilename"
oUrl:cUserid := "theusername"
oUrl:cPassword := "thepassword"
oFtp := tIPClientFtp():New( oUrl, .T. )

[...]

or use a manual Cwd() with something like this:
lSuccess := oFtp:Cwd( "theremotepath" )

Mkd() is similar:
lSuccess := oFtp:Mkd( "thenewremotepath" )

Prepend a forward slash to the remote path to start from the root.

If you want to know where you are you can get the current path with:
cCurrentPath := oFtp:Pwd()

Regards,
Klas

gtv625

unread,
Mar 12, 2013, 6:24:25 AM3/12/13
to harbou...@googlegroups.com
HI Klas,
thank You for Your attention, You are perfectly right about my current installation because what i downloaded few days ago i installed over my old installation that is 3.0.0 but downloaded late in 2011. both times i used only binaries.
for the moment my old clipper app is working without any problem and tonight  i will Your suggestion. this is first time that i have to adopt OOP and even that i'm aware of what it is i need some more time to implement this.

regards,
vanja

Klas Engwall

unread,
Mar 12, 2013, 2:44:03 PM3/12/13
to harbou...@googlegroups.com
Hi Vanja,

> thank You for Your attention, You are perfectly right about my current
> installation because what i downloaded few days ago i installed over my
> old installation that is 3.0.0 but downloaded late in 2011. both times i
> used only binaries.

That sounds risky. It is safer to keep different versions in different
directory trees and use different batch files to activate each version
(or dump the old if you do not need it). If you copy the new over the
old and get strange errors when working with the mixed version, it can
be very difficult to find the problem.

Regards,
Klas

Evangelos Tsakalidis

unread,
Mar 12, 2013, 3:33:45 PM3/12/13
to harbou...@googlegroups.com
Hallo Klass.

Can we have display of progress for the downloadFile() / uploadFile() method?

Thank you.

Evangelos

2013/3/12 Klas Engwall <har...@engwall.com>


Regards,
Klas

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-users+unsubscribe@googlegroups.com
Web: http://groups.google.com/group/harbour-users

--- You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Klas Engwall

unread,
Mar 12, 2013, 7:39:30 PM3/12/13
to harbou...@googlegroups.com
Hi Evangelos,

> Can we have display of progress for the downloadFile() / uploadFile()
> method?

Yes you can although I have never tried it myself. Those methods use the
ReadToFile() and WriteFromFile() methods that do the actual download and
upload. Both have code for calling a gauge you supply with something
like oFtp:exGauge := "MyGauge"

The already existing calls look like this:

IF ! Empty( ::exGauge )
hb_ExecFromArray( ::exGauge, { nSent, nSize, Self } )
ENDIF

Your gauge function MyGauge() will receive the three arguments (sent so
far, total size, and the ftp object), and from there it is up to you to
handle them.

Regards,
Klas

Evangelos Tsakalidis

unread,
Mar 13, 2013, 2:24:16 AM3/13/13
to harbou...@googlegroups.com
Hi Klas.

Thank you.

2013/3/13 Klas Engwall <har...@engwall.com>


Regards,
Klas

Reply all
Reply to author
Forward
0 new messages