daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Oct 17th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form method="post" action="" enctype="multipart/form-data">
  2.      <label for="fichier">Ajouter raster :</label><br />
  3.      <input type="file" name="fichier"  />
  4.      <input type="submit" name="submit" value="Envoyer" /> </form>
  5.        <?php $name = $_FILES['fichier']['name']; $db = pg_connect('host=localhost port=5432 dbname=gisdb user=postgres >password=******');           $output =shell_exec("raster2pgsql -a -s 32629 -I -C -F -M '".$_FILES["fichier"]["tmp_name"]."' eau_param_hydro | psql -U postgres -d gisdb -h localhost -p 5432 ");         $req = exec(" SELECT * FROM '".$output."' ");
  6.     $result = pg_query($db,"INSERT INTO eau_param_hydro(rast,filename)  >VALUES('".$req."','".$name."');");
  7.          if (!$result) {
  8.          $errormessage = pg_last_error();
  9.          echo "Error with query: " . $errormessage;
  10.          exit();
  11.         }  pg_close();  ?>
  12.    
  13. <?php $fcontents = file_get_contents($_FILES["fichier"]["tmp_name"]);
  14.    $db = pg_connect('host=localhost port=5432 dbname=gisdb user=postgres password=******');        
  15.    $sql = 'INSERT INTO eau_param_hydro(filename,rast)
  16.         VALUES($1, ST_FromGDALRaster( ($2)::bytea ) );';
  17.    $params = array($_FILES["fichier"]["name"], pg_escape_bytea($fcontents) );
  18.  
  19.   $result = pg_query_params($db, $sql, $params);
  20.   pg_close();  ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand