88import java .io .*;
99import java .util .Arrays ;
1010import java .util .HashMap ;
11- import java .util .List ;
1211import java .util .Map ;
1312
1413@ SuppressWarnings ({"rawtypes" , "unchecked" })
@@ -117,10 +116,12 @@ public Map uploadLarge(Object file, Map options, int bufferSize, long offset, St
117116 InputStream input ;
118117 long length = -1 ;
119118 boolean remote = false ;
119+ String filename = null ;
120120 if (file instanceof InputStream ) {
121121 input = (InputStream ) file ;
122122 } else if (file instanceof File ) {
123123 length = ((File ) file ).length ();
124+ filename = ((File ) file ).getName ();
124125 input = new FileInputStream ((File ) file );
125126 } else if (file instanceof byte []) {
126127 length = ((byte []) file ).length ;
@@ -132,6 +133,7 @@ public Map uploadLarge(Object file, Map options, int bufferSize, long offset, St
132133 } else {
133134 File f = new File (file .toString ());
134135 length = f .length ();
136+ filename = f .getName ();
135137 input = new FileInputStream (f );
136138 }
137139 }
@@ -140,6 +142,9 @@ public Map uploadLarge(Object file, Map options, int bufferSize, long offset, St
140142 if (remote ) {
141143 result = upload (file , options );
142144 } else {
145+ if (!options .containsKey ("filename" ) && StringUtils .isNotBlank (filename )) {
146+ options .put ("filename" , filename );
147+ }
143148 result = uploadLargeParts (input , options , bufferSize , length , offset , uniqueUploadId , progressCallback );
144149 }
145150 return result ;
0 commit comments