Scripting - network fail

Hi!

Ok so im trying to understand the scripting.
I have made an .exe on my local computer.
Taking it with me to where i want it, a network drive named G:. Did not work at first but made a absolute path as G: for virutal data (if it matters that it is G or whatever but now it works).

Im playing with the scripting to make local links to database, using this in usermain:

end;
function OpenDlgFile: String;
begin
Result := OpenFileDialog(“Select a File to open”, “.”, “.”, “All files (.)|.”, “”);
end;

procedure OpenAFile(Filepath: String);
var
res: integer;
begin
res := OpenFile(FilePath, “”, SW_SHOWNORMAL);
if res < 32 then
begin
MessageBox("Error while opening: " + FilePath + ". Error code: " + inttostr(res), “Launch Error”, MB_OK+MB_ICONERROR);
exit;
end;
end;

With my “just to test it out code in php” :

Filename

if (isset($_GET[‘bild2’])) {

echo “Asking for filename…
”;
// Executes HEScript to call the system dialog “Open”…
$filename = exo_return_hescriptcom(“UserMain.OpenDlgFile”, “Error”);

// The $filename variable contains the full path to the file selected by the user. It can be passed to fopen
// for instance.

if (empty($filename))
{
echo “You have not selected any file. Operation canceled
”;
return;
}
$Titel = nl2br(htmlentities($_POST[‘Titel’]));
$timezone = ‘Europe/Stockholm’;
$date = date(‘y-m-d h:i:s’);
$datid = date(‘Y-m-d H:i:s’,strtotime($date. ’ ‘.$timezone));
$cn=mysqli_connect(“localhost:3307”,“root”,“root1”,“metodbok”) or die(“Could not Connect My Sql”);
$filename2 = urlencode($filename);
$sql = "INSERT INTO image (image,id,datid,filnamn) VALUES (’$filename2’,‘30’,‘$datid’,‘$Titel’)";
if (mysqli_query($cn, $sql)) {
echo “successfully !”;
}
else {
echo "Error: " . $sql . “” . mysqli_error($cn);
}

echo “<a href="hescript://UserMain.OpenAFile|$filename2">$
”;

}

So this works great on my local computer. My thougt was it was gonna fail on network drive and i had to replace G: with \server\folder. But when i tried it the .exe just shut down.
The link was made in database and then i tried to call it again the .exe broke down again just like the code did not work just bcause it was on network drive?

(Ugly code, dont know yet how to get filename from that coding so i just solved it while trying to get this done)