Page 2 of 2 FirstFirst 12
Results 26 to 29 of 29

Thread: How can I send a bitmap to a php file?

  1. #26
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, well without using some sort of precompiled/binary program, I'm not sure how else to do this. Good luck

  2. #27
    Join Date
    Jan 2007
    Location
    East Coast, USA
    Posts
    138
    Mentioned
    0 Post(s)
    Quoted
    38 Post(s)

    Default

    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

  3. #28
    Join Date
    Oct 2006
    Location
    On a boat
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well, this thread is a few months old but here's another working answer:

    server 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";

    ?>
    client side:
    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.

  4. #29
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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.

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. type send not send keys in vb
    By Noob King in forum C#/Visual Basic Help and Tutorials
    Replies: 5
    Last Post: 10-23-2008, 09:14 PM
  2. How to send the key esc.
    By Derek- in forum OSR Help
    Replies: 3
    Last Post: 12-23-2007, 03:37 AM
  3. Find Bitmap in Bitmap file
    By fORCE_wORKS in forum RS3 Outdated / Broken Scripts
    Replies: 8
    Last Post: 12-13-2007, 11:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •