Php 未将大位图上载到服务器

Php 未将大位图上载到服务器,php,android,bitmap,Php,Android,Bitmap,我正在使用PHP post请求将用户在Android中拍摄的照片上传到我的共享主机。我保留图片的文件路径,以便将其解码为位图,然后将其发送到服务器 编辑:看起来问题是图片的大小,如果我试图上传一张大小超过800 KB的照片,我会从服务器收到以下错误: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>413 Request Entity Too La

我正在使用PHP post请求将用户在Android中拍摄的照片上传到我的共享主机。我保留图片的文件路径,以便将其解码为位图,然后将其发送到服务器

编辑:看起来问题是图片的大小,如果我试图上传一张大小超过800 KB的照片,我会从服务器收到以下错误:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>413 Request Entity Too Large</title>
</head><body>
<h1>Request Entity Too Large</h1>
The requested resource<br />/upload_image.php<br />
does not allow request data with GET requests, or the amount of data provided in
the request exceeds the capacity limit.
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

413请求实体太大
请求实体太大
请求的资源
/upload\u image.php
不允许GET请求中包含请求数据,或中提供的数据量 请求超出了容量限制。 此外,未找到404 尝试使用ErrorDocument处理请求时遇到错误

Android方法:

private void uploadImage() {
        Bitmap bitmap = BitmapFactory.decodeFile(CURRENT_PHOTO_PATH);
        //Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.image);
        Log.d("Bitmap processing", "DONE!");
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, 90, stream);

        byte[] byte_arr = stream.toByteArray();
        String image_str = Base64.encodeBytes(byte_arr);
        final ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();

        nameValuePairs.add(new BasicNameValuePair("image", image_str));
        nameValuePairs.add(new BasicNameValuePair("event_id", Integer
                .toString(0)));

        Thread t = new Thread(new Runnable() {

            @Override
            public void run() {
                try {
                    HttpClient httpclient = new DefaultHttpClient();
                    HttpPost httppost = new HttpPost(url);
                    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                    HttpResponse response = httpclient.execute(httppost);
                    final String the_string_response = convertResponseToString(response);
                    Log.d("Image processing", "UPLOADED!");
                    runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            Toast.makeText(UploadImage.this,
                                    "Ready " + the_string_response,
                                    Toast.LENGTH_LONG).show();
                        }
                    });

                } catch (final Exception e) {
                    runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            Toast.makeText(UploadImage.this,
                                    "ERROR " + e.getMessage(),
                                    Toast.LENGTH_LONG).show();
                        }
                    });
                    System.out.println("Error in http connection "
                            + e.toString());
                }
            }
        });
        t.start();

    }
private void uploadImage(){
位图位图=位图工厂.decodeFile(当前图片路径);
//位图Bitmap=BitmapFactory.decodeResource(getResources(),R.drawable.image);
Log.d(“位图处理”,“完成!”);
ByteArrayOutputStream=新建ByteArrayOutputStream();
压缩(bitmap.CompressFormat.JPEG,90,流);
byte[]byte_arr=stream.toByteArray();
字符串image\u str=Base64.encodeBytes(byte\u arr);
最终ArrayList nameValuePairs=新ArrayList();
添加(新的BasicNameValuePair(“image”,image_str));
添加(新的BasicNameValuePair(“事件id”),整数
.toString(0));
线程t=新线程(新的可运行线程(){
@凌驾
公开募捐{
试一试{
HttpClient HttpClient=新的DefaultHttpClient();
HttpPost HttpPost=新的HttpPost(url);
setEntity(新的UrlEncodedFormEntity(nameValuePairs));
HttpResponse response=httpclient.execute(httppost);
最终字符串\u字符串\u响应=convertResponseToString(响应);
Log.d(“图像处理”,“上传!”);
runOnUiThread(新的Runnable(){
@凌驾
公开募捐{
Toast.makeText(UploadImage.this,
“就绪”+字符串响应,
Toast.LENGTH_LONG).show();
}
});
}捕获(最终异常e){
runOnUiThread(新的Runnable(){
@凌驾
公开募捐{
Toast.makeText(UploadImage.this,
“错误”+e.getMessage(),
Toast.LENGTH_LONG).show();
}
});
System.out.println(“http连接错误”
+e.toString());
}
}
});
t、 start();
}
我想知道我怎样才能解决这个问题?
提前谢谢你