
Quote from Neal Stone on May 29, 2023, 2:12 amI want to test for the existence of a file and return a result based on if it exists or now. Part of the filename needs to be a variable. Checking for an itnernet connection was one thing I tried but it returns false regardless if the file is there or not.
Any ideas?
I want to test for the existence of a file and return a result based on if it exists or now. Part of the filename needs to be a variable. Checking for an itnernet connection was one thing I tried but it returns false regardless if the file is there or not.
Any ideas?

Quote from luishp on May 29, 2023, 12:53 pm@neal-stone you can use this if your server allows CORS or you are executing the app within the same domain as the file you want to check.
neoAjaxLoad "https://yourdomain.com/yourfile.txt" "txt" "success" "error"Otherwise you will need a server side script:
if (isset($_POST['filename'])) { $filename = $_POST['filename']; $baseDirectory = '/path/to/directory/'; // Replace with your desired base directory $filePath = $baseDirectory . $filename; if (file_exists($filePath)) { echo "The file '$filename' exists."; } else { echo "The file '$filename' does not exist."; } } else { echo "No file name was provided."; }Regards.
@neal-stone you can use this if your server allows CORS or you are executing the app within the same domain as the file you want to check.
neoAjaxLoad "https://yourdomain.com/yourfile.txt" "txt" "success" "error"
Otherwise you will need a server side script:
if (isset($_POST['filename'])) {
$filename = $_POST['filename'];
$baseDirectory = '/path/to/directory/'; // Replace with your desired base directory
$filePath = $baseDirectory . $filename;
if (file_exists($filePath)) {
echo "The file '$filename' exists.";
} else {
echo "The file '$filename' does not exist.";
}
} else {
echo "No file name was provided.";
}
Regards.

Quote from Neal Stone on June 1, 2023, 1:59 amFixed! Turns out this doesn't work until I upload my WebApp to the server on my domain hosting, so CheckInternetConnection does indeed do the trick.
So now I know that it doesn't always work on my local computer.
Fixed! Turns out this doesn't work until I upload my WebApp to the server on my domain hosting, so CheckInternetConnection does indeed do the trick.
So now I know that it doesn't always work on my local computer.

Quote from joferar333 on June 5, 2023, 6:15 pm@luishp, @vadim,@gaev,@Darbdenral
Luis este es el mismo ejemplo que me enviaste para saber si un archivo existia o no
Lo he replicado al pie de la letra, yo no tengo prohibicion de Cors en mi servidor por lo que deberia funcionar pero me dice que NO EXITE cuando el archivo
en realidad esta en la ruta indicada..Yo utilizo un boton con el siguiente comando
neoAjaxLoad "https://globaldima.com/1/4/16.txt" "txt" "success" "error"
En el frente hay una variable [RESULTADO]
y tengo las dos subrutinas
success
setvar "[resultado]" "EXISTE"
error
setvar "[resultado]" "NO EXISTE"
pero al ajecutar el boton siempre me da NO EXISTE cuando el archivo existe y esta en esa ruta...
Que estoy haciendo mal o porque no funciona?
Gracias
ENGLISH
to know if a file existed or not
I have replicated it verbatim, I do not have Cors prohibition on my server so it should work but it tells me NO EXIT when the file
It's actually on the right path.I use a button with the following command
neoAjaxLoad "https://globaldima.com/1/4/16.txt" "txt" "success" "error"
In front there is a variable [RESULT]
and I have the two subroutines
success
setvar "[result]" "EXISTS"
error
setvar "[result]" "NOT EXISTS"
but when executing the button it always gives me DOES NOT EXIST when the file exists and is in that path...
What am I doing wrong or why it doesn't work?
Thank you
@luishp, @vadim,@gaev,@Darbdenral
Luis este es el mismo ejemplo que me enviaste para saber si un archivo existia o no
Lo he replicado al pie de la letra, yo no tengo prohibicion de Cors en mi servidor por lo que deberia funcionar pero me dice que NO EXITE cuando el archivo
en realidad esta en la ruta indicada..
Yo utilizo un boton con el siguiente comando
neoAjaxLoad "https://globaldima.com/1/4/16.txt" "txt" "success" "error"
En el frente hay una variable [RESULTADO]
y tengo las dos subrutinas
success
setvar "[resultado]" "EXISTE"
error
setvar "[resultado]" "NO EXISTE"
pero al ajecutar el boton siempre me da NO EXISTE cuando el archivo existe y esta en esa ruta...
Que estoy haciendo mal o porque no funciona?
Gracias
ENGLISH
to know if a file existed or not
I have replicated it verbatim, I do not have Cors prohibition on my server so it should work but it tells me NO EXIT when the file
It's actually on the right path.
I use a button with the following command
neoAjaxLoad "https://globaldima.com/1/4/16.txt" "txt" "success" "error"
In front there is a variable [RESULT]
and I have the two subroutines
success
setvar "[result]" "EXISTS"
error
setvar "[result]" "NOT EXISTS"
but when executing the button it always gives me DOES NOT EXIST when the file exists and is in that path...
What am I doing wrong or why it doesn't work?
Thank you
Uploaded files:
Quote from Gaev on June 5, 2023, 6:28 pm@joferar333
I have not downloaded your App, but in your post you specify ...
neoAjaxLoad "https://globaldima.com/1/4/16.txt" "txt" "success" "error"I placed this URL in my Browser's Address Box (and hit the Enter key) ... and I got nothing.
Usually, when the file does not exist, it will say so ; hence, I tried 16.gktxt ... and it did say (rightly) that the file did not exist.
So, my conclusion is that you have an empty file (or one that has unprintable characters).
I have not downloaded your App, but in your post you specify ...
neoAjaxLoad "https://globaldima.com/1/4/16.txt" "txt" "success" "error"
I placed this URL in my Browser's Address Box (and hit the Enter key) ... and I got nothing.
Usually, when the file does not exist, it will say so ; hence, I tried 16.gktxt ... and it did say (rightly) that the file did not exist.
So, my conclusion is that you have an empty file (or one that has unprintable characters).

Quote from joferar333 on June 5, 2023, 6:34 pm@gaev
the file is correct and it is empty...
That is the idea, you should only inform me if it is there or not so that I can carry out the action accordingly, but if it says that it does not exist because it is empty, it is working badly since I do not ask for content, just to know if it exists or not...
the file is correct and it is empty...
That is the idea, you should only inform me if it is there or not so that I can carry out the action accordingly, but if it says that it does not exist because it is empty, it is working badly since I do not ask for content, just to know if it exists or not...
Quote from Gaev on June 5, 2023, 6:45 pm@joferar333
you should only inform me if it is there or not so that I can carry out the action accordingly, but if it says that it does not exist because it is empty, it is working badly since I do not ask for content, just to know if it exists or not
The command you are using is neoAjaxLoad (not some command that asks if the file exists) ... and if there is nothing to load, it returns an error (not because it is empty but because there is no data to load !!!).
you should only inform me if it is there or not so that I can carry out the action accordingly, but if it says that it does not exist because it is empty, it is working badly since I do not ask for content, just to know if it exists or not
The command you are using is neoAjaxLoad (not some command that asks if the file exists) ... and if there is nothing to load, it returns an error (not because it is empty but because there is no data to load !!!).

Quote from joferar333 on June 5, 2023, 7:00 pm@gaev
Ok I didn't know, Luis sent me that in my office to be able to find out if a file existed or not... and I used it as he sent it to me... Could you please give me a hand with the error routine that I cannot manage, for example, in this commandneoPhpFileWrite "./[mydate]/16.txt" "[client] - [mobile]" false ""How can I know if the action was completed or there was an error...Thank you in advance
Quote from Gaev on June 5, 2023, 7:15 pm@joferar333
I have mentioned to you several times in the recent past that I have zero experience with PHP ;(the last time I tried this language was over 25 years ago), so please don't keep asking me to assist you in this area.
I have mentioned to you several times in the recent past that I have zero experience with PHP ;(the last time I tried this language was over 25 years ago), so please don't keep asking me to assist you in this area.

Quote from Darbdenral on June 5, 2023, 10:53 pm@joferar333
I will attempt this ;)
Does this work for you?
It's not Php, but I think your just looking for anything that checks for file exists, right?
It's just an alternative that does seem to check whether the file exists, zero byte or not.
Important:
I'm using the CORS proxy for us all to do testing, you will need to enable it by clicking the first button in the attached app and then clicking on their enable proxy button.After you enabled CORS, remember the proxy can sometimes be REAL slow, so have patience and wait for results.
I did not test on my remote server without proxy.. but it shouldn't matter..
I will attempt this ;)
Does this work for you?
It's not Php, but I think your just looking for anything that checks for file exists, right?
It's just an alternative that does seem to check whether the file exists, zero byte or not.
Important:
I'm using the CORS proxy for us all to do testing, you will need to enable it by clicking the first button in the attached app and then clicking on their enable proxy button.
After you enabled CORS, remember the proxy can sometimes be REAL slow, so have patience and wait for results.
I did not test on my remote server without proxy.. but it shouldn't matter..
Uploaded files:Quote from Gaev on June 5, 2023, 11:12 pm@darbdenral
Thanks; works as advertized.
I had come across this CORS Proxy facility a few days ago, but I was unsure whether to use it for my personal App (get stock data) because the 'private account key' within the request might get exposed to unsavory characters.
Do you have experience using this facility ?
Thanks; works as advertized.
I had come across this CORS Proxy facility a few days ago, but I was unsure whether to use it for my personal App (get stock data) because the 'private account key' within the request might get exposed to unsavory characters.
Do you have experience using this facility ?

Quote from Darbdenral on June 5, 2023, 11:24 pmDo you have experience using this facility ?
@gaev
Excellent!
Yes, I agree, I can't vouch for their security.
I wouldn't use it for anything you can't expose.
thanks!
Do you have experience using this facility ?
Excellent!
Yes, I agree, I can't vouch for their security.
I wouldn't use it for anything you can't expose.
thanks!

Quote from joferar333 on June 6, 2023, 12:07 am@gaev,@darbdenral
No, the truth is that I have no experience in this type of installation, what's more, I don't understand why use a proxy when my server doesn't have any kind of problem with the data. I made it fit on purpose.
I never thought it would be so difficult to find out if a file exists or not... (HOW I MISS NEOBOOK) Since in these matters everything was super easy and without so many complications... but of course I couldn't generate an app... .
In short, I think I'm going to give up, not only because I don't achieve this goal, but also because I can't achieve a simple routine that handles the error like neobook does. I can't understand the commands and there isn't a specific example, just commands and syntax but nothing in concrete... anyway thank you very much for your time
No, the truth is that I have no experience in this type of installation, what's more, I don't understand why use a proxy when my server doesn't have any kind of problem with the data. I made it fit on purpose.
I never thought it would be so difficult to find out if a file exists or not... (HOW I MISS NEOBOOK) Since in these matters everything was super easy and without so many complications... but of course I couldn't generate an app... .
In short, I think I'm going to give up, not only because I don't achieve this goal, but also because I can't achieve a simple routine that handles the error like neobook does. I can't understand the commands and there isn't a specific example, just commands and syntax but nothing in concrete... anyway thank you very much for your time

Quote from Darbdenral on June 6, 2023, 2:51 am@joferar333 Your not installing anything.. All your doing by clicking that button is getting access to a simple proxy, nothing is installed and it allows CORS disabled so we can test from our computers..
Anyways, I also uploaded the app on my site, without using the the proxy for demo. It's a small task, try later when you have more steam. ;)
Yes, the learning curve is much higher with VisualNeoWeb but the initial steps are always the hardest, it gets easier.
https://tropicdesigns.net/exists
your welcome!
@joferar333 Your not installing anything.. All your doing by clicking that button is getting access to a simple proxy, nothing is installed and it allows CORS disabled so we can test from our computers..
Anyways, I also uploaded the app on my site, without using the the proxy for demo. It's a small task, try later when you have more steam. ;)
Yes, the learning curve is much higher with VisualNeoWeb but the initial steps are always the hardest, it gets easier.
https://tropicdesigns.net/exists
your welcome!

Quote from joferar333 on June 6, 2023, 10:18 amHi @darbdenral
I have tried your example and it works but when
I try it with my files and it doesn't work anymoreThey have created a personal proxy server for me, could you reproduce the example but with a real file on my server?
the proxy is: https://globaldima.tutmosis.urltemporal.com/
and the file I want to use is:With content: https://globaldima.com/1/4/16.txt
Empty: https://globaldima.com/1/4/20.txt
both files existAnd this file should say that it does not exist
https://globaldima.com/1/4/28.txtHopefully you can make it work I outside of your example I have not been able to make this work in the real files...
Best Regards
Hi @darbdenral
I have tried your example and it works but when
I try it with my files and it doesn't work anymore
They have created a personal proxy server for me, could you reproduce the example but with a real file on my server?
the proxy is: https://globaldima.tutmosis.urltemporal.com/
and the file I want to use is:
With content: https://globaldima.com/1/4/16.txt
Empty: https://globaldima.com/1/4/20.txt
both files exist
And this file should say that it does not exist
https://globaldima.com/1/4/28.txt
Hopefully you can make it work I outside of your example I have not been able to make this work in the real files...
Best Regards