fix upload file name

This commit is contained in:
Page Asgardius 2022-09-15 06:01:38 -07:00
parent ac2b4408a1
commit e139b841ff

View file

@ -52,7 +52,6 @@ public class Uploader extends AppCompatActivity {
AWSCredentials myCredentials; AWSCredentials myCredentials;
AmazonS3 s3client; AmazonS3 s3client;
ProgressBar simpleProgressBar; ProgressBar simpleProgressBar;
String[] filename;
long filesize; long filesize;
File ufile; File ufile;
private static final long MAX_SINGLE_PART_UPLOAD_BYTES = 5 * 1024 * 1024; private static final long MAX_SINGLE_PART_UPLOAD_BYTES = 5 * 1024 * 1024;
@ -105,9 +104,9 @@ public class Uploader extends AppCompatActivity {
@Override @Override
public void run() { public void run() {
if (fprefix.getText().toString().endsWith("/") || fprefix.getText().toString().equals("")) { if (fprefix.getText().toString().endsWith("/") || fprefix.getText().toString().equals("")) {
fkey = fprefix.getText().toString()+filename[filename.length-1]; fkey = fprefix.getText().toString()+getDisplayName(fileuri);
} else { } else {
fkey = fprefix.getText().toString()+"/"+filename[filename.length-1]; fkey = fprefix.getText().toString()+"/"+getDisplayName(fileuri);
} }
//System.out.println(fkey); //System.out.println(fkey);
progress = 0; progress = 0;
@ -202,7 +201,6 @@ public class Uploader extends AppCompatActivity {
// provided to this method as a parameter. Pull that uri using "resultData.getData()" // provided to this method as a parameter. Pull that uri using "resultData.getData()"
if (resultData != null && resultData.getData() != null) { if (resultData != null && resultData.getData() != null) {
fileuri = resultData.getData(); fileuri = resultData.getData();
filename = fileuri.getPath().split("/");
//System.out.println("File selected successfully"); //System.out.println("File selected successfully");
//System.out.println("content://com.android.externalstorage.documents"+file.getPath()); //System.out.println("content://com.android.externalstorage.documents"+file.getPath());
} else { } else {