2

サーバーにjava.io.IOException: Value too large for defined data type約 2.1 GB の大きなファイルをアップロードするとエラーが発生します。そして私のコードは:

     URL oUrl = new URL(servierUrl);
     HttpURLConnection  connection = (HttpURLConnection) oUrl.openConnection();
       connection.setDoOutput(true);
       connection.setRequestMethod("POST");
       connection.setRequestProperty("Connection", "Keep-Alive");
       connection.setRequestProperty("Content-Type", "multipart/form-       data");
       connection.setRequestProperty("Content-Length", String.valueOf(nChunkSize));
       connection.setConnectTimeout(1800000); 

     InputStream oFileInputStream = new FileInputStream(new File(sFilePath));

     OutputStream outputStream = new DataOutputStream(connection.getOutputStream());
     .
     .
     . // here I'm dividing the stream chunks, every chunk 5Mb and uploading the chuck  to server 
          but in the chunk #410 (5Mb * 410) it cause an exception return the exception as I mentioned above.
          before that every chunk I upload it success
     .
     .

助けてください。

4

1 に答える 1