0

I create a form to import file to my data base postgessql but I have this error:

the code is :

<?php
    $name = $_FILES['fichier']['name'];
         //$raster = pg_escape_string($_POST['fichier']); 
         $db = pg_connect('host=localhost port=5432 dbname=gisdb user=**** password=*****'); 
         $output = shell_exec('raster2pgsql -a -s 32629 -I -C -M $_FILES["fichier"]["tmp_name"] eau_param_hydro | psql -U postgres -d gisdb -h localhost -p 5432 ');
        // $query = "INSERT INTO eau_param_hydro(rast,filname) VALUES('".$output."','".$name."')"; 
         $result = pg_query($db,"INSERT INTO eau_param_hydro(rast,filename) VALUES('.$output.','.$name.');");
         if (!$result) { 
         $errormessage = pg_last_error(); 
         echo "Error with query: " . $errormessage; 
         exit(); 
pg_close(); 
?>
oustyle
  • 103
  • 1
  • 10
  • the erreur is : ( ! ) Warning: pg_query(): Query failed: ERROR: rt_raster_from_wkb: wkb size (1) < min size (61) LINE 1: INSERT INTO eau_param_hydro(rast,filename) VALUES('..','.tes... ^ in C:\wamp\www\test\test.php on line 31 Call Stack # Time Memory Function Location 1 0.0010 137192 {main}( ) ..\test.php:0 2 0.1000 137800 pg_query ( ) ..\test.php:31 Error with query: ERROR: rt_raster_from_wkb: wkb size (1) < min size (61) LINE 1: INSERT INTO eau_param_hydro(rast,filename) VALUES('..','.tes... ^ – oustyle Aug 31 '16 at 09:31
  • Don't write your username and password here! Please edit it! – MAESTRO_DE Aug 31 '16 at 09:38
  • thanks a lot marcel – oustyle Aug 31 '16 at 09:42

0 Answers0