InternetFileExists - Forum

Forum Navigation
You need to log in to create posts and topics.

InternetFileExists

Hello.

Would anyone have a solution or explanation please?

On a web server I have a file called 'testa'.

If I ask with the command internetfileexists if the testb file (not testa) exists

I have the true answer when it does not exist.

Thank you

@feli

Copy the relevant code from your pub and post it here.

@Gaev

InternetFileExists "http://s57161992.../testb" "[Result]" ""

I haven't testb on server but testa.

But the answer ([Result]) is true for testb.

@feli

1) According to the help info for this command, the url of the internet file should be of the form http://www.yoursite.com/sample.txt

Is http://s57161992.../testb the exact url of the file ? ... or are you using the 3 dots because you do not wish to post the real url on a public forum ?

2) I also wanted to see how you determined the content of [Result]

Anyhow, try something like this ...

SetVar "[TestbExists]" ""
InternetFileExists "!s57161992.../testb" "[TestbExists]" ""
AlertBox "TestbExists" "[TestbExists]"

... take note of ! before s57161992 ... otherwise VisualNEOWin might try to evaluate (do math) on the name because of /

If this still gives you an incorrect result, try it on a file with an extension (like testxyz.txt) ... just in case it is interpreting the file name (without the extension) as a folder name.

Post your results here.

 

Hello Gaev

Thank you for your answers.

This is not a web address problem since the file is found.

I tried with extension, and the problem remains the same.

I finally think it's normal and there's nothing to do, testa and testb are so similar...
It's the same with numbered files....
The result will be true for a file search named 12345, while the remote file is 12346...

@feli

I finally think it's normal and there's nothing to do, testa and testb are so similar...
It's the same with numbered files....
The result will be true for a file search named 12345, while the remote file is 12346...

On my website, I set up test1234.txt and test1235.txt ... test1236.txt does NOT exist.

You can verify this by using the URL's (used below) in your Browser's address box.

This button code ...

SetVar "[Test1234Exists]" ""
InternetFileExists "www.scriptedlogic.com/test1234.txt" "[Test1234Exists]" ""
AlertBox "Test1234Exists" "[Test1234Exists]"

.. returns True (as expected) ... and this button code ...

SetVar "[Test1236Exists]" ""
InternetFileExists "www.scriptedlogic.com/test1236.txt" "[Test1236Exists]" ""
AlertBox "Test1236Exists" "[Test1236Exists]"

... returns False (also as expected).

I also did a test where I used the same [variable] to store the result from both enquiries ... and it still worked as expected.

Try the above code in your pub and see if you get different results than me.

If not, you need to post the exact/unmodified set of pub commands (do a select/copy/paste) you are using.

 

Gaev.

I have on my web site a file named 1234.txt... it contains 1234. You can try...

InternetFileExists "http://s571619927.onlinehome.fr/phgtz/1235.txt" "[Result]" ""
AlertBox "" "[Result]"------- [Result] is TRUE.
InternetGet "http://s571619927.onlinehome.fr/phgtz/1235.txt" "[Result]" ""
AlertBox "" "[Result]"------- [Result] is 1234.

If you get FALSE for the first [Result] and an error for the second, then it is possible that it is a bug on the French version.

Feli, try to paste your URL  (with 1235.txt) into browser address....

You will recive the same result...

Take a look into browser address again - you will see 1234.txt (NOT 1235.txt)

This is not NeoBook's bug, this is a some bug of the server...

@feli

I can confirm the observations of (eagle eyed) @peter !!!

This suggests that at your server end, there is some kind of redirection happening.

In my browser, I tried the following files (and got the stated responses)

123.txt ... redirects to 1234.txt
1231.txt ... redirects to 1234.txt
1237.txt ... redirects to 1234.txt
1239.txt ... redirects to 1234.txt
123a.txt ... redirects to 1234.txt
2234.txt ... redirects to 1234.txt
9234.txt ... redirects to 1234.txt
91234.txt ... redirects to 1234.txt

9123.txt ... error 404
neo1234.txt ... error 404

1234.dat ...

Multiple Choices
The document name you requested (/phgtz/1234.dat) could not be found on this server. However, we found documents with names similar to the one you requested.
Available documents:

/phgtz/1234.txt (common basename)

 

possible that it is a bug on the French version.

I don't think so, but you can check it out by trying the code in my previous post (that accesses files on my domain) ... you should get the same results as I did.

 

Thanks guys

I tested everything and I understood that it was indeed a server problem.
I'll try to see if there is a way to change these redirects...