【发布时间】:2017-10-09 23:04:51
【问题描述】:
我正在尝试将图像文件从我的 android 应用程序上传到服务器。这是我的 php 文件,它正在处理来自我的网站和 iOS 应用程序的传入图像,用于move_uploaded_file 函数:
<?php include '../../../init.php';
$post_id = $_GET['post_id'];
$image_temp = $_FILES['image']['tmp_name'];
$image_name = $_FILES['image']['name'];
$image_ext = strtolower(end(explode('.', $image_name)));
upload_page_image($image_temp, $image_ext, $post_id);
现在,在 android 中,我遇到了 Base64 编码字符串:
params.put("image",imageToString(bitmap));
然后,我将它带到我的 PHP 文件中,如下所示:
<$php
....
$image = base64_decode(_POST['image']);
...
但是现在,我如何将其制动到$_FILES['image']['temp_name'] 和$_FILES['image']['name']?我经历的所有其他示例都使用file_put_contents。我需要它是move_uploaded_files。
感谢任何帮助。 谢谢
【问题讨论】:
标签: php android image image-uploading