forked from Landris18/Pharmacetica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.php
executable file
·52 lines (48 loc) · 1.69 KB
/
upload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
$oFileInfos = $_FILES["fichier_image"];
$pdp_name= $oFileInfos["name"];
$pdp_name = str_replace(' ', '_', $pdp_name);
$pdp_temporaire = $oFileInfos["tmp_name"];
$code_erreur = $oFileInfos["error"];
$destination = "./stockage/pic.png";
switch($code_erreur)
{
case UPLOAD_ERR_OK:
if(copy($pdp_temporaire, $destination)){
//$verify_insertion = $query_bdd->insertion_fichier_pdp($id, $pdp_name, $action);
require('connect_bdd.php');
$query = new Query_bdd();
$decode = exec('python qrd.py');
echo $decode;
}
else{
throw new Exception("Erreur copie fichier");
}
break;
case UPLOAD_ERR_NO_FILE:
throw new Exception("Aucun fichier séléctionner");
break;
case UPLOAD_ERR_INI_SIZE:
throw new Exception("Taille fichier > upload_max_filesize");
break;
case UPLOAD_ERR_PARTIAL:
throw new Exception("Fichier partiellement transféré");
break;
case UPLOAD_ERR_NO_TMP_DIR:
throw new Exception("Aucun répertoire temporaire");
break;
case UPLOAD_ERR_CANT_WRITE:
throw new Exception("Erreur lors de l’écriture du fichier sur disque");
break;
default:
throw new Exception("Fichier non transféré");
break;
}
if($verify_insertion === false){
throw new Exception("Erreur insertion fichier");
echo 'allo';
}
else{
echo "Succed";
}
?>