Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 1 Monat, 1 Woche
Letzter Beitrag:
vor 1 Monat, 1 Woche
Beteiligte Autoren:
GuenterP, Jose Antonio Garrido, Michael Drechsel

[WD21] HTTP functions. File exists?

Startbeitrag von GuenterP am 18.05.2017 05: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?

Antworten:

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.

PS: Works only if you are the owner of the webserver :-)

von Michael Drechsel - am 18.05.2017 07:59
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.

von GuenterP - am 18.05.2017 08:10
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.

von Jose Antonio Garrido - am 18.05.2017 08:45
Hi Jose Antonio,

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

von GuenterP - am 18.05.2017 08:53
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.