使用上传脚本Android在php中接收图像的问题 [英] issue for received image in php with upload script Android
本文介绍了使用上传脚本Android在php中接收图像的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此代码上传图片:
http://vikaskanani.wordpress.com/2011/01/11/android-upload-image-or-file-using-http-post-multi-part/
I use this code for upload image: http://vikaskanani.wordpress.com/2011/01/11/android-upload-image-or-file-using-http-post-multi-part/
我已更换
bm = BitmapFactory.decodeFile("/data/data/fshizzle.com/files/image.jpg");
和
HttpPost postRequest = new HttpPost("http://10.0.2.2/upload.php");
全部!
我不能在php文件中收到信息
我使用此代码php工作,如果使用HTML代码
I can not receved info in php file I use this code php work if use html code
<form method="POST" action="upload.php" enctype="multipart/form-data">
<!-- On limite le fichier à 100Ko -->
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Fichier : <input type="file" name="avatar">
<input type="submit" name="envoyer" value="Envoyer le fichier">
</form>
代码PHP:
$dossier = './upload/';
$fichier = basename($_FILES['sfsdfsdf']['name']);
if(move_uploaded_file($_FILES['sfsdfsdf']['tmp_name'], $dossier . $fichier))
//Si la fonction renvoie TRUE, c'est que ça a fonctionné...
{
echo 'Upload effectué avec succès !';
}
else //Sinon (la fonction renvoie FALSE).
{
echo '<br>Echec de l\'upload !';
}
一个简单的 if(isset($ _ FILES [' sfsdfsdf']))
什么是好代码不起作用?
a simple if(isset($_FILES['sfsdfsdf']))
don't work what is a good code?
推荐答案
解决了我的测试与Mydns和我的真手机一起工作。
Solved i test with Mydns and my real phone and it's work.
这篇关于使用上传脚本Android在php中接收图像的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文