checking if a file is available?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
checking if a file is available?
I want to to program a function that my program check if a specific file is on a server. if this file is not there, it should report an error. How can a accomplish that?
Like a button. If I press on the button, the script looks if there is a file called "test.txt" on http://www.server.com. if yes, then button click goes to card "inside". If the file is not there, the button click goes to card "error".
Like a button. If I press on the button, the script looks if there is a file called "test.txt" on http://www.server.com. if yes, then button click goes to card "inside". If the file is not there, the button click goes to card "error".
Re: checking if a file is available?
Hi,
Mark
Code: Select all
put url "http://economy-x-talk.com/bla.xyz" into myData
if the result contains "404" then
-- doesn't exist
else
-- do something with the data
end if
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: checking if a file is available?
Mark.
Your suggestion will show whether the url exists, not whether a certain file within that url does. I was intrigued by this question. Is there a "there is a" operator/methodology for files within a webpage, similar to that capability within the LC IDE or within ones desktop environment? Wouldn't you have to examine the index within the webpage, and wouldn't that require admin access?
Craig Newman
Your suggestion will show whether the url exists, not whether a certain file within that url does. I was intrigued by this question. Is there a "there is a" operator/methodology for files within a webpage, similar to that capability within the LC IDE or within ones desktop environment? Wouldn't you have to examine the index within the webpage, and wouldn't that require admin access?
Craig Newman
Re: checking if a file is available?
Craig,
Craig, in those cases that a server responds by parsing the url and returning some data, instead of just returning the contents of a file, one should either find a way to communicate with that server, e.g. by writing a php function, or one should use ftp or ssh, but OP seems to expect he can use http, which led me to the answer I posted previously.
Kind regards,
Mark
Craig, in those cases that a server responds by parsing the url and returning some data, instead of just returning the contents of a file, one should either find a way to communicate with that server, e.g. by writing a php function, or one should use ftp or ssh, but OP seems to expect he can use http, which led me to the answer I posted previously.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: checking if a file is available?
Got it, Mark. Thanks.
Craig
Craig
Re: checking if a file is available?
Thank you!