Page 1 of 1

save an image url

Posted: Mon Feb 10, 2020 6:05 pm
by Silvio.Falconi
when I save an Image the url is

"C:\WORK\PRG\WINBEACH\images\due_lettini_regista.png"

I wish save as " ..\images\due_lettini_regista.png"

how I can resolve ?

Re: save an image url

Posted: Mon Feb 10, 2020 6:20 pm
by Otto
Silvio,
you have all the functions inside
c:\fwh\source\function\filename.prg.
Did you see that Antonio announced the availability of the mod harbour servers?

Best regards,
Otto

Re: save an image url

Posted: Mon Feb 10, 2020 9:23 pm
by Silvio.Falconi
Otto,
Sorry,
For now i cannot use mod_harbour
I must terminate my app
I tried with mod_harbour with no success

Re: save an image url

Posted: Tue Feb 11, 2020 8:25 am
by Silvio.Falconi
Otto ,
sorry I TRIED with these functions

//?cFileNoPath( cPathMask )
//?cFilePath( cPathMask )
//?cFileDisc( cPathMask )
//?cFileNoExt( cPathMask )
//?cFileSubDir( cPathMask )
//? cFileUNC( cPathMask )
//? cRelativePath( cPathMask )

with no success!!!!

none give me ..\images\name.png

Re: save an image url

Posted: Tue Feb 11, 2020 8:34 am
by Silvio.Falconi
Resolved

Code: Select all

Function test()
Local cPathMask:="C:\WORK\PRG\WINBEACH\images\due_lettini_regista.png"

? RelativePath( cPathMask ) + UrlImage(cPathMask)
return nil

Function UrlImage(curlImg)  
   Local aTmp
   local nLevel := 1
   local x
   local cCad   :=""
   aTmp := Hb_ATokens( curlImg, "\" )
   For x = Len( aTmp ) - nLevel + 1 To Len( aTmp )
       cCad += AllTrim( aTmp[ x ] )
       if x < Len( aTmp )
          cCad  += "\"
       endif
   Next x
  return cCad

 Function RelativePath( cFile )
   local cPath, cRelPath, cTemp
   cPath:= cFilePath(cFile)
   cTemp:= left(cPath,len(cPath)-1)
   cRelPath:=  "." + right(cPath, len(cPath) + 1 - rat("\",cTemp) )
return cRelPath