Subversion Repository Public Repository

Nextrek

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
<?php
session_start();

//var_dump($_SESSION);

/*if (!array_key_exists("images", $_SESSION)) {
    $_SESSION["images"] = array();
}*/

$image_filename = "";
$risposta = array();
$risposta["return"] = 0;

if(isset($_FILES['image_file']))
{
    $file = $_FILES['image_file'];
    if($file['error'] == UPLOAD_ERR_OK and is_uploaded_file($file['tmp_name']))
    {
        $imgExtention = substr(strrchr($file["name"],'.'),1);
        $image_filename = uniqid().".".$imgExtention;
        //echo session_id();

        if (!file_exists("./images/temp/".session_id())) {
            mkdir("./images/temp/".session_id(), 0777, true);
        }

        move_uploaded_file($file['tmp_name'], "./images/temp/".session_id()."/".$image_filename);
        //array_push($_SESSION["images"], $image_filename);
    }
    else {
        $risposta["return"] = 0;
    }
}

$risposta["image_file"] = $image_filename;

echo json_encode($risposta);

?>

Commits for Nextrek/Android/SmartCharging/endPoints/upload_image.php

Diff revisions: vs.
Revision Author Commited Message
309 Diff Diff FSallustio picture FSallustio Mon 13 Jul, 2015 16:08:26 +0000
304 Diff Diff FSallustio picture FSallustio Mon 13 Jul, 2015 15:36:12 +0000
302 FSallustio picture FSallustio Mon 13 Jul, 2015 15:29:06 +0000