Php 如何在slim 3中上载图像文件?
我必须使用slim 3在服务器上上传图像文件。我想将文件路径保存在表中,并将相应的图像保存在服务器上的文件夹中Php 如何在slim 3中上载图像文件?,php,android,html,slim,Php,Android,Html,Slim,我必须使用slim 3在服务器上上传图像文件。我想将文件路径保存在表中,并将相应的图像保存在服务器上的文件夹中 $filenamePath = md5(time().uniqid()).".jpg"; $decoded=base64_decode($image); file_put_contents("images/".$filenamePath,$decoded); $sth = $this->db->prepare("UPDAT
$filenamePath = md5(time().uniqid()).".jpg";
$decoded=base64_decode($image);
file_put_contents("images/".$filenamePath,$decoded);
$sth = $this->db->prepare("UPDATE orders set status =:status,
total_amount=:amount,created_at=:date1,receipt=:path WHERE id=:orderId");
$sth->bindParam("orderId",$orderid );
$sth->bindParam("status", $status);
$sth->bindParam("amount", $amount);
$sth->bindParam("date1", $date);
$sth->bindParam("path", $filenamePath);
$sth->execute();
这是我在slim 3类中的代码
怎么了?有人能帮忙吗
尝试图像的完整路径 示例:
file_put_contents("/testslim/v1/src/images/".$filenamePath,$decoded);
尝试图像的完整路径 示例:
file_put_contents("/testslim/v1/src/images/".$filenamePath,$decoded);
只需更改上述代码中的路径,并授予图像文件夹的权限
$filenamePath = md5(time().uniqid()).".jpg";
$decoded=base64_decode($image);
file_put_contents("images/".$filenamePath,$decoded);
$sth = $this->db->prepare("UPDATE orders set status =:status,
total_amount=:amount,created_at=:date1,receipt=:path WHERE id=:orderId");
$sth->bindParam("orderId",$orderid );
$sth->bindParam("status", $status);
$sth->bindParam("amount", $amount);
$sth->bindParam("date1", $date);
$sth->bindParam("path", $filenamePath);
$sth->execute();
只需更改上述代码中的路径,并授予图像文件夹的权限是否有任何错误?
我必须使用slim 3在服务器上上载图像文件
。怎么了?它和Android有什么关系?无法打开流没有这样的文件或目录..这个错误在那里???错误在哪里?你没有告诉我它和Android有什么关系。你有什么错误吗?我必须使用slim 3在服务器上上传图像文件。怎么了?它和Android有什么关系?无法打开流没有这样的文件或目录..这个错误在那里???错误在哪里?你没有告诉我它和安卓有什么关系。
$filenamePath = md5(time().uniqid()).".jpg";
$decoded=base64_decode($image);
file_put_contents("images/".$filenamePath,$decoded);
$sth = $this->db->prepare("UPDATE orders set status =:status,
total_amount=:amount,created_at=:date1,receipt=:path WHERE id=:orderId");
$sth->bindParam("orderId",$orderid );
$sth->bindParam("status", $status);
$sth->bindParam("amount", $amount);
$sth->bindParam("date1", $date);
$sth->bindParam("path", $filenamePath);
$sth->execute();