(=_INFO NOFORMREAD=>1 _INFO=)(=PAGE TITLE=>Get Upload BODY<= (=_CODE require 'ljlib.pl'; require 'ljprotocol.pl'; return &server_down_html() if ($SERVER_DOWN); &connect_db; my $MAX_SIZE_KBYTES = 40; # note - we need CGI and NOFORMREAD because BML can't handle multipart/form-data use CGI qw(:standard); my $q = new CGI; my $req = { mode => "uploadpic", user => scalar $q->param("user"), password => scalar $q->param("password"), hpassword => scalar $q->param("hpassword"), default => scalar $q->param("make_default"), }; my $res = {}; my $src = $q->param("src"); if ($src eq "file") { my $fh = $q->param("userpic"); my $num_read = 0; my $total_read = 0; my $img = ""; while ($num_read = read($fh, $img, 4096, $total_read)) { $total_read += $num_read; $total_read <= $MAX_SIZE_KBYTES * 1024 or return &bullet_errors(["File size too big. File cannot exceed ${MAX_SIZE_KBYTES}K."]); } $req->{data} = $img; } elsif ($src eq "url") { $req->{url} = $q->param("urlpic"); } else { return &bullet_errors(["No image source specified."]); } &LJ::do_request($dbh, $req, $res, {}); $res->{success} eq "OK" or return &bullet_errors([$res->{errmsg}]); return "(=H1 Success H1=) (=P Your image has been uploaded. It looks like this:

{picid}\" WIDTH=$res->{width} HEIGHT=$res->{height}>
You can edit your picture keywords to be able to use this picture selectively in the future. P=) (=P You can view your journal here. P=)"; _CODE=) <=BODY PAGE=)