I need to use SCAR with a php file to take a bitmap saved on my computer and save it to a .bmp file on my hosting site where the php file is.
This should be possible because in SCAR you can do
SCAR Code:
program New;
var
Source: string;
FileNumber: integer;
Client: integer;
begin
FileNumber:= OpenFile('Path.bmp', false);
ReadFileString(FileNumber, Source, FileSize(FileNumber));
CloseFile(FileNumber);
FileNumber:= RewriteFile('Path2.bmp', false);
WriteFileString(FileNumber, Source);
CloseFile(FileNumber);
end.
It will take the image in Path.bmp and copy it to a new bitmap file, Path2.bmp.
So I figured this would work-
SCAR Code:
program New;
var
Source: string;
FileNumber: integer;
Client: integer;
begin
FileNumber:= OpenFile('Path.bmp', false);
ReadFileString(FileNumber, Source, FileSize(FileNumber));
CloseFile(FileNumber);
Client:= InitializeHTTPClient(true, true);
AddPostVariable(Client, 'pic', Source);
PostHTTPPageEx(Client, 'http://yoursite.php');
end.
It takes that same bmp information but sends it to the php file.
The php source is
PHP Code:
<?php
$pic = $_POST['pic'];
if ($pic <> '')
{
$handle = fopen('pic.bmp', 'w');
fwrite($handle, $pic);
fclose($handle);
}
?>
It works as far as sending it there and the file pic.bmp gets written.
But not with the same information I sent to it.
The crazy little chars that make up a bmp file can't be sent from SCAR to a php file.
No matter what picture I send, it writes BMZ9 to the bmp file.
So is there any way to do this?
I don't have to use php, I'm just looking for any way possible to write a bmp file on the web from SCAR.