1 %# $Id: upload.mc,v 1.3 2009-04-16 18:09:44 wosch Exp $
5 % if (!defined $filename) {
7 Please note that this form expects a
8 <a href="http://explain.z3950.org/"
11 <a href="http://www.loc.gov/standards/sru/explain/"
12 >SRU explainResponse</a>.
14 <form method="post" action=""
15 enctype="multipart/form-data">
17 ZeeRex file to upload:
18 <input type="file" name="filename" size="50"/>
20 <input type="submit" name="_submit" value="Submit"/>
30 if ($r->isa('Apache2::RequestRec')) {
31 require Apache2::Request;
32 require Apache2::Upload;
33 my $req = new Apache2::Request($r);
34 my $upload = $req->upload('filename');
40 $fin = $r->upload()->fh();
44 $m->comp("/details/error.mc", msg => "Upload cancelled");
48 my $xml = join("", <$fin>);
49 my $xc = irspy_xpath_context($xml);
50 my $id = irspy_record2identifier($xc);
51 my $db = ZOOM::IRSpy::connect_to_registry();
52 my $conn = new ZOOM::Connection($db, 0,
53 user => "admin", password => "fruitbat",
54 elementSetName => "zeerex");
55 ZOOM::IRSpy::_rewrite_zeerex_record($conn, $xc->getContextNode());
62 <a href="<% xml_encode("/full.html?id=" . uri_escape_utf8($id))
63 %>">the new record</a>.