B.boy B.boy - 4 months ago
282 0

I'm having errors uploading my image to my webhost. Using this php code. Btw, i'm doing an android application but the uploading dont work. Can you guys help me? thanks :D

PHP

Uploading to webhost

<?PHP 

    if(isset($_POST['image'])){
        $now = DateTime::createdFromFormat('U.u', microtime()true);
        $id = $now->format('YmdMisu');

        $path = "upload\".$id."."jpeg";
        $image = $_POST['image']

        if(file_put_contents($path, base64_decode($image) != false){
            echo "uploaded_success";
            exit;
    }else{
            echo"upload_failed"
            exit;
        }
    }else{
        echo "image_not_in";
        exit;
    }



?>
Comments