PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 2024 → [WB23] FileDisplay on WebDev
[WB23] FileDisplay on WebDev
Débuté par ARV, 13 nov. 2018 21:57 - 11 réponses
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 13 novembre 2018 - 21:57
Hi

I have this code:
FileDisplay(sDescarga,"application/unknown",sDescarga)


With this I can download and open my file when I'm on testing mode.
But if I compile and do it from a server, it download the file but it cannot open the file.

I try it with this:
ShellExecute(CompleteDir(fWebDir())+sDescarga)


I tought it coulf work but no it doesn't

also all of this code are on browser, this browser have the name and extension of my files to download, when I download the file I close the tab.

any idea?
Thanks!.

--
Best Regards
ARV
Membre enregistré
1 623 messages
Popularité : +100 (114 votes)
Posté le 14 novembre 2018 - 11:46
Hi, be carreful : ShellExecute(CompleteDir(fWebDir())+sDescarga) Will lauch the application ON THE SERVER not on the CLIENT.

What to you mean by :
" it download the file but it cannot open the file."
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 14 novembre 2018 - 14:19
Hi François C.

yeah I thought about that it will open on the server, I want it to be open on the client.

François C. wrote:
Hi, be carreful : ShellExecute(CompleteDir(fWebDir())+sDescarga) Will lauch the application ON THE SERVER not on the CLIENT.

What to you mean by :
" it download the file but it cannot open the file."



all I mean it's to download the file from the server and then it open to the user (client)

the part to download it works now I want to open the file from code but on the computer of the user, the file it's always on download files.

thanks for the reply!

--
Best Regards
ARV
Message modifié, 14 novembre 2018 - 14:21
Membre enregistré
1 623 messages
Popularité : +100 (114 votes)
Posté le 14 novembre 2018 - 14:55
Ok, if you want it to open automatically when download, you need to specify the MIME type of document :

FileDisplay(sDescarga,"application/unknown",sDescarga)

can be replaced by (for PDF documents)
FileDisplay(sDescarga,"application/x-pdf",sDescarga)
Message modifié, 14 novembre 2018 - 14:56
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 14 novembre 2018 - 18:24
Hi François C.

Oh I see but if I want to open xls it will be something like:
FileDisplay(sDescarga,"application/x-xls",sDescarga)


or is it different?

I search a little but I'm not sure:
https://help.windev.com/en-US/…

--
Best Regards
ARV
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 14 novembre 2018 - 18:31
Hi I try this code:
FileDisplay(sDescarga,"application/x-pdf",sDescarga)


it doesn't open the file, it only download it.
also this code is in another page, I open this page in another tab of the browser then when it's on the web user side, then I close the tab, I'm not sure if this could affect the process to open it.

--
Best Regards
ARV
Membre enregistré
1 623 messages
Popularité : +100 (114 votes)
Posté le 15 novembre 2018 - 00:07
The opening of documents is a setting under your webbrowser.
You cannot FORCE the website to open a document
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 15 novembre 2018 - 14:27
Hi François C.

Thanks for the reply!
I will see this setting, and I will tell you if it works and if I found them.

--
Best Regards
ARV
Membre enregistré
118 messages
Posté le 11 décembre 2018 - 16:11
hi,

just left out the third parameter

FileDisplay(sDescarga,"application/x-pdf")


meikl :)
Membre enregistré
1 623 messages
Popularité : +100 (114 votes)
Posté le 14 décembre 2018 - 10:01
The 3rd parameter is just to rename the file for the client, nothing more.
Membre enregistré
118 messages
Posté le 18 décembre 2018 - 15:41
just read the help:

: Optional character string

    Name of file to save if the Web user wants to download the file onto his computer. If this parameter is specified, the file download is automatically proposed.


look at the last sentence :)
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 02 janvier 2019 - 22:45
Hi all

meikl wrote:
just read the help:

: Optional character string

    Name of file to save if the Web user wants to download the file onto his computer. If this parameter is specified, the file download is automatically proposed.


look at the last sentence


That means the file will show up for the user? or it only show to where to save the file on the client side?

thanks for all of the replys

--
Best Regards
ARV