Php 创建文件夹并将图像保存到这个从android应用程序发送的文件夹中

Php 创建文件夹并将图像保存到这个从android应用程序发送的文件夹中,php,android,Php,Android,我有下面的PHP代码来创建一个文件夹,并将图像保存到这个生成的文件夹中。工作原理是生成文件夹,但关联的图像不会插入到文件夹中,因此文件夹始终为空: $uid = $_POST['uid']; $image = $_POST["image"]; $suffix = $db->createRandomID(); //function creates random numbers and stores in $suffix

我有下面的PHP代码来创建一个文件夹,并将图像保存到这个生成的文件夹中。工作原理是生成文件夹,但关联的图像不会插入到文件夹中,因此文件夹始终为空:

            $uid = $_POST['uid'];
            $image = $_POST["image"];

            $suffix = $db->createRandomID(); //function creates random numbers and stores in $suffix
            $url = "http://XXX.XXX.XXX.XX/uploads_offer/";
            $image_name = "img_offer_".$suffix."".$uid."_".date("Y-m-d-H-m-s").".jpg";
            $path = $url."".$image_name; // path of saved image 


            // base64 encoded utf-8 string
            $binary2 = base64_decode($image);

            // binary, utf-8 bytes
            header("Content-Type: bitmap; charset=utf-8");

            $filepath = $image_name; 


            if (file_exists("../uploads_offer/".$uid)){
                //$file = fopen("../uploads_offer/".$uid . $image_name, "wb");
                $file = fopen("../uploads_offer".$uid.$image_name, "wb");
                fwrite($file, $binary2);
                fclose($file);

            }else{
                $result8 = mkdir("../uploads_offer/".$uid, 0755);
                $file = fopen("../uploads_offer".$uid.$image_name, "wb");
                fwrite($file, $binary2);
                fclose($file);
            }
fopen()
调用中缺少斜杠(
/
):

$file = fopen("../uploads_offer/".$uid."/".$image_name, "wb");