如何在服务器上传多个图像文件?

How to upload multiple image file in server?

我正在尝试使用 asynctask httpclient 在服务器中上传多张图片。我知道如何上传单张图片,但我不知道如何上传多张图片。我尝试像...

for (int i = 0; i < photo.length; i++) {
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    photo[photoIndex].compress(Bitmap.CompressFormat.PNG, 100, stream);
    InputStream in = new ByteArrayInputStream(stream.toByteArray());
    params.put("uploaded_file[" + photo[i] + "]", in,
    System.currentTimeMillis() + ".jpg");
}

现在我想发送文件路径 如何将我的文件路径发送到 PHP 服务器。

在这段代码中,我对多张图片使用了位图数组 photo[photoIndex]。通过这段代码,我可以将我的多张照片的位图发送到 PHP 服务器。

这是上传单张照片的代码。

ByteArrayOutputStream stream = new ByteArrayOutputStream();
photo[photoIndex].compress(Bitmap.CompressFormat.PNG, 100, stream);
InputStream in = new ByteArrayInputStream(stream.toByteArray());
params.put("uploaded_file", in,
System.currentTimeMillis() + ".jpg");

这是 运行 正确的。

for (String p : YOURARRAYLIST) {
       ByteArrayOutputStream stream = new ByteArrayOutputStream();
       photo[photoIndex].compress(Bitmap.CompressFormat.PNG, 100, stream);
       InputStream in = new ByteArrayInputStream(stream.toByteArray());
       params.put("uploaded_file", in,
       System.currentTimeMillis() + ".jpg");
}