Download file via html5
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Download file via html5
Hi all,
I have a FWH app running into a W7 virtual machine.
I would like to add a button to download a file via html from a remote server.
Is there a function to do this ? Thank you in advance.
I have a FWH app running into a W7 virtual machine.
I would like to add a button to download a file via html from a remote server.
Is there a function to do this ? Thank you in advance.
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Download file via html5
Marco,
this is what I'm using (but it has nothing to do with HTML5):
EMG
this is what I'm using (but it has nothing to do with HTML5):
Code: Select all | Expand
FUNCTION GETURLTOFILE( cUrl, cFile, lAuth )
LOCAL lOk := .F.
LOCAL oCli
DEFAULT lAuth := .F.
TRY
oCli = TIPClientHttp():New( cUrl )
IF lAuth THEN oCli:UseBasicAuth()
IF EMPTY( oCli ); BREAK; ENDIF
oCli:nConnTimeout = -1
IF !oCli:Open(); BREAK; ENDIF
DEFAULT cFile := oCli:oUrl:cFile
IF !oCli:ReadToFile( cFile ); BREAK; ENDIF
lOk = !EMPTY( oCli:cReply ) .AND. "OK" $ UPPER( oCli:cReply )
IF !lOk; FERASE( cFile ); ENDIF
CATCH
END
IF !EMPTY( oCli ); oCli:Close(); ENDIF
RETURN lOk
EMG
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Download file via html5
Hi Enrico,
not bad, thank you, anyway, the best for my customer would to "browse" the directory and select the file instead to write the full url.
Any ideas about this ?
not bad, thank you, anyway, the best for my customer would to "browse" the directory and select the file instead to write the full url.
Any ideas about this ?
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Download file via html5
I mean a remote public directory.
A customer has a mac server with static ip and I would like to provide the feature to select a file there from my FWH app (hosted on another server)
A customer has a mac server with static ip and I would like to provide the feature to select a file there from my FWH app (hosted on another server)
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Download file via html5
Marco Turco wrote:I mean a remote public directory.
A customer has a mac server with static ip and I would like to provide the feature to select a file there from my FWH app (hosted on another server)
Code: Select all | Expand
oInternet := tInternet():New()
oFtp := tFtp():New(cIp,oInternet,cFtpUserName,cFtpPassword)
aFiles:=oFtp:Directory(cFolderName+"\"*.* )
Display the contents of the aFile to the user to choose the required file and then download it. Just an idea
Regards
Anser
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
-
- Posts: 989
- Joined: Thu Nov 24, 2005 3:01 pm
- Location: Madrid, España
Re: Download file via html5
Hi Marco
Enrico's code is fine for downloading, you should to provide the link to the file. If you need to surf the website to find the file, there are 2 options: is the webserver using WEBDAV, or just HTTP?
WEBDAV is like ftp built on top of http, would make things easy. If it's published as an html website, it will depend on how the website publishes content so a procedure can be made to browse it.
What software is running in the server? Just a webserver like Apache? Or sth else?
Marco Turco wrote:I would like to add a button to download a file via html from a remote server.
Enrico's code is fine for downloading, you should to provide the link to the file. If you need to surf the website to find the file, there are 2 options: is the webserver using WEBDAV, or just HTTP?
WEBDAV is like ftp built on top of http, would make things easy. If it's published as an html website, it will depend on how the website publishes content so a procedure can be made to browse it.
What software is running in the server? Just a webserver like Apache? Or sth else?
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Download file via h tml5
I would avoid to use the ftp.
The EMG solution is fine but I would prefer a solution like that you have (for example) on a webmail where to attach a file you press a button and you can select it from your local computer.
The EMG solution is fine but I would prefer a solution like that you have (for example) on a webmail where to attach a file you press a button and you can select it from your local computer.
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP