directory function
Posted: Mon Aug 26, 2019 9:01 pm
Is there a way to scan a directory and get a list of the files in it?
Thanks,
Robert
Thanks,
Robert
No. That's not possible for security reasons.RobertRioja wrote:Is there a way to scan a directory and get a list of the files in it?
well, you surely wouldn't like it if everyone could search your hard drive from the browser.RobertRioja wrote:It seems that every time I try to do anything with SP, I am told that it cannot be done for security reasons. So we can write very secure but marginally useful programs.
but you run your SpiderBasic-Application in a Browser. And the Browser must not access the file system. And even if it were possible, then you would only access the filesystem of your computer (client) and not the filesystem of the server.RobertRioja wrote:It's my program, my directory, my files
Good luck with that!RobertRioja wrote:What I want to do can easily be done with a million tools that are already readily available (HTML, CSS, PHP, AJAX, etc, etc)
Code: Select all
Procedure WindowCloseEvent()
CloseWindow(EventWindow()) ; Close the specific window
EndProcedure
Procedure HttpGetEvent(Success, Result$, UserData)
If Success
Debug Result$
Else
Debug "HTTPRequest(): Error"
EndIf
EndProcedure
; Open a window and bind the events.
OpenWindow(0, 10, 10, 400, 400, "Main Window", #PB_Window_Background)
BindEvent(#PB_Event_CloseWindow, @WindowCloseEvent())
HTTPRequest(#PB_HTTP_Post, "Files.php", "?&folder=MyFolder", @HttpGetEvent())
Code: Select all
<?php
// Get the folder name that was passed by SpiderBasic.
$folder = isset($_POST['folder']) ? $_POST['folder'] : '';
// Make an array with all files in the folder.
$files = scandir($folder);
// Return all file names in a string, separated by colons.
for ($i = 0; $i < count($files) - 1; $i++) {
echo $files[$i] . ":";
}
echo $files[$i];
?>
Perhaps. On the other hand, this is a programming language, not a cup of hot McDonald's coffee. Thus, some prerequisites are expected from the user, such as basic knowledge of concepts and possibilities of stuff you use.RobertRioja wrote:There should also be better explanations (and examples) of the interaction between SpiderBasic and other things like PHP.
Well, CGI is "minimal" per se, so no issues there.I purchased PureBasic some time ago and use it often. It can create CGI executables but again, the manual is minimal at best.
Once again, what is the problem? Purebasic has no crosscompiler abilities. It is nowhere stated that it has. Thus, it obviously hasn't. Super simple stuff, frankly. In addition, if you write "purebasic crosscompiler" and hit "I'm feeling lucky" in Google, you will get that very same information.And since most servers are Linux based, you must run the Linux version of PureBasic to create a Linux executable CGI.
So what, you have spent many many years writing what your products can't do, rather than what they can?I have spent many decades as a software/hardware engineer and engineering manager. And I have spent many, many years as a technical writer producing user manuals, product specs, software requirements, service manuals, etc.