PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD21] HTTP functions. File exists?
[WD21] HTTP functions. File exists?
Débuté par GuenterP, 18 mai 2017 07:25 - 4 réponses
Posté le 18 mai 2017 - 07:25
Hi,

I just wanted to look whether a certain file (size between 50 - 100 Mb) is existing in a certain directory on a web server.

Ok, I know that I could use FTP functions but I'm hesitating to include FTP user / password combination in in several hundred pieces of an application. For Security reasons my customers would have to define a separate FTP-user for their servers with restricted rights .. imho this is much too complex.

So, I tried to use HTTPRequest(..) and HTTPSend(..). These functions do detect the file but are doing an immediate download at the same time. Which takes time and is not needed at all. I just want to see whether the file is existing ...

Is there any hint you could give me?
Posté le 18 mai 2017 - 09:59
Hi,

create a webservice.

Just a awp site with the filename as a parameter. The site returns false or true if the file exist or not.
Posté le 18 mai 2017 - 10:10
Hi Michael,

most probably, most of our customers are using or will use their own web servers. Last year we got rid of the last customer using our web server with a HFSQL database for a dozen cash registers and I'm not eager to get any new ones onto our server.
Posté le 18 mai 2017 - 10:45
Hi,

I have litte time since I have to go in 1 min.
I made a test with WD Using Sockets.

Open it.
Replace RTFControl with Multiline Text Control.
Comment lines that added RTF content to the control.
Add SocketChangeTransmissionMode(csSocketName,SocketEndTag) afer SocketConnect(csSocketName,gnListeningPort,NetIPAddress(gfsServer))
Run the application.
Select Port 80 and Client
Select www.windev.com and whatever
Put this code onto the Text Control:
HEAD /img/visual/21/logo-pcsoft.png HTTP/1.1 HOST: windev.com Accept: */* User-Agent: runscope/0.1 Add another new blank line or two at the end
And, finally, press send. You will get a response back, filled in the table above, with the size of the pcsoft logo, without downloading it.

So it may be usefull to you.
Regards,
José Antonio.
Posté le 18 mai 2017 - 10:53
Hi Jose Antonio,

thank you for your help! I'm going to test that one!