Android : Upload image to PHP server

女生的网名这么多〃 提交于 2019-12-05 09:46:34

Have you verified that the user apache (or whichever user php is running as) has permissions to write to the directory specified in $file_path?

Put the following code in the same directory as your PHP script is, and then visit it in your web browser.

<?php

$file_path = 'uploads/';

$success = file_put_contents($file_path . "afile", "This is a test");

if($success === false) {
    echo "Couldn't write file";
} else {
    echo "Wrote $success bytes";
}

?>

Does this give a success message or an error message?

If it gives an error message, trying changing the ownership of the uploads directory.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!