mardi 23 août 2016

how to add raster data postgis from a web interface

in the design framework and the development of a GIS platform WEB (Web Mapping) for the dissemination of spatial data, I need to create a web interface that help the administrator to add these spatial data to postgis via a web interface I try this code I get no error but the data is not added

<form method="post" action="" enctype="multipart/form-data">
     <label for="fichier">Ajouter raster :</label><br />
     <input type="file" name="fichier"  />
     <input type="submit" name="submit" value="Envoyer" />
</form>
<?php 
        $db = pg_connect('host=5432 dbname=gisdb user=postges password=ou$$am@16'); 

        $raster = pg_escape_string($_POST['fichier']); 
        $name = $_FILES['$raster']['name']; 

        $query = "INSERT INTO eau_param_hydro(rast,filname) VALUES('". addslashes($raster) ."','" . $name . "')"; 
        $result = pg_query($query); 
        if (!$result) { 
            $errormessage = pg_last_error(); 
            echo "Error with query: " . $errormessage; 
            exit(); 
        } 
        pg_close(); }
        ?> 

  </body>




Aucun commentaire:

Enregistrer un commentaire