Yeah, well without using some sort of precompiled/binary program, I'm not sure how else to do this. Good luck![]()
Yeah, well without using some sort of precompiled/binary program, I'm not sure how else to do this. Good luck![]()
Looks like your best chance is to send the file to the server using SCAR's bitmap-to-string function
A php script that could by itself, with no user interaction, upload a file would be ideal...
I played around with this but to no avail...
PS
Something just popped into my head
If this is a script intended only for your use you could make a php script to upload a file and a firefox extension that would automatically fill out the form and do all necessary things to upload
all scar would have to do is open up the php script in firefox(not that hard just set firefox as default browser and use scar's OpenWebPage function)
If you want help using this method just email me : centillion50@yahoo.com
~Fastler
Well, this thread is a few months old but here's another working answer:
server side:
client side:PHP Code:<?php
if($_SERVER['REQUEST_METHOD'] == "POST" && strlen($_POST['pic']) > 0) {
file_put_contents('out.bmp',base64_decode($_POST['pic']));
print "picture uploaded";
} else print "unknown request";
?>
SCAR Code:program New;
const
Codes64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
//from [url]http://www.swissdelphicenter.ch/torry/showcode.php?id=1524[/url]
//the codes const needed to be changed around
function Encode64(S: string): string;
var
i: Integer;
a: Integer;
x: Integer;
b: Integer;
begin
Result := '';
a := 0;
b := 0;
for i := 1 to Length(s) do
begin
x := Ord(s[i]);
b := b * 256 + x;
a := a + 8;
while a >= 6 do
begin
a := a - 6;
x := b div (1 shl a);
b := b mod (1 shl a);
Result := Result + Codes64[x + 1];
end;
end;
if a > 0 then
begin
x := b shl (6 - a);
Result := Result + Codes64[x + 1];
end;
end;
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', Encode64(Source));
PostHTTPPageEx(Client, 'http://yourdomain.com/pic.php');
end.
I got the Base64 encode function from http://www.swissdelphicenter.ch/torr...de.php?id=1524
Last edited by Laser; 04-01-2009 at 03:26 AM.
That's faster than any other way I have tried, but it still won't work with what I need it to do.
I'm pretty sure I'll have to use a plugin or another language.
There are currently 1 users browsing this thread. (0 members and 1 guests)