Click here to Skip to main content
15,885,740 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
hello,

I am trying to upload a video to linux server from a videoview in android but the absolute path of the file selected from gallery is not proper.Below is the code for getting file path:

Java
Uri mVideoURI = data.getData();
            String result;
            String [] filepath = {MediaStore.Video.Media.DATA};
            Cursor cursor = getContentResolver().query(mVideoURI, filepath, null, null, null);
            if (cursor == null) { // Source is Dropbox or other similar local file path
                result = mVideoURI.getPath();
            } else {
                cursor.moveToFirst();
                int idx = cursor.getColumnIndex(MediaStore.Video.Media.DATA);
                result = cursor.getString(idx);
                cursor.close();
            }
            Log.d("Result",""+result);
            uploadfilepath=result;

            videoView.setVideoURI(mVideoURI);
Posted
Comments
Richard MacCutchan 26-Nov-15 8:21am    
What is the proper value, and what is the value you see?
Sergey Alexandrovich Kryukov 27-Nov-15 0:55am    
The path on client side or server side? The gallery on the client side or server side? What does it mean "selected"?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900