Android Upload of File to Server

后端 未结 3 392
我寻月下人不归
我寻月下人不归 2020-12-20 03:39

Based on the recommendations of a previous post I\'m trying to use Android: Uploading image on server with php however I get a file not found exception.

Here\'s my f

3条回答
  •  天命终不由人
    2020-12-20 04:14

    You are trying to get an InputStream from a Uri ? This might be easier :

    private void doFileUpload(Uri fileUri){
        // some code
        InputStream inputStream = getContentResolver().openInputStream(fileUri);
        // more code
        dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + "some_file_name" +"\"" + lineEnd);
        // the rest of the code
    }
    

提交回复
热议问题