Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8581861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:09:11+00:00 2026-06-11T21:09:11+00:00

I am trying to upload a video to the server using the post method,

  • 0

I am trying to upload a video to the server using the post method, but I am getting

FileNotFoundException

Here’s my code. In the path variable I am getting “content:/media/external/video/media/2”

public class VideoPlayUploadActivity extends Activity {
private VideoView video_play;
private Button accept_and_go;
private Button reject_and_do;
Uri vid;
String user;
String question;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_view);

    video_play = (VideoView) findViewById(R.id.videoView1);
    accept_and_go = (Button) findViewById(R.id.button_accept_and_go_over_video);
    reject_and_do = (Button) findViewById(R.id.button_reject_and_do_over_video);

    Intent extras = getIntent();
    vid = Uri.parse(extras.getStringExtra("uri"));

    if (vid == null) {
        Toast.makeText(VideoPlayUploadActivity.this, "No Video",
                Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(VideoPlayUploadActivity.this,
                "Playback: " + vid.getPath(), Toast.LENGTH_LONG).show();
        MediaController mc = new MediaController(this);
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        video_play.setMediaController(mc);
        video_play.setVideoURI(vid);
        video_play.start();

    }
    accept_and_go.setOnClickListener(accept_go_listener);
}

private View.OnClickListener accept_go_listener = new View.OnClickListener() {

    @Override
    public void onClick(View v) {

        // TODO Auto-generated method stub
        String path = vid.getPath();
        File file = new File(path);
        try {
            HttpClient client = new DefaultHttpClient();
            String postURL = "xxxxxxxxxxxxxxxxxxxxxxxxupdateAnswerFile";
            HttpPost post = new HttpPost(postURL);
            FileBody bin = new FileBody(file);
            StringBody user = new StringBody("1");
            StringBody question = new StringBody("25");
            MultipartEntity reqEntity = new MultipartEntity(
                    HttpMultipartMode.BROWSER_COMPATIBLE);
            reqEntity.addPart("user", user);
            reqEntity.addPart("question", question);
            reqEntity.addPart("answer", bin);
            post.setEntity(reqEntity);
            HttpResponse response = client.execute(post);
            HttpEntity resEntity = response.getEntity();
            if (resEntity != null) {
                Log.i("RESPONSE", EntityUtils.toString(resEntity));
            }
        } catch (Exception e) {
            Toast.makeText(getApplicationContext(), "exception", 0).show();
            e.printStackTrace();
        }
    }
};
private View.OnClickListener reject_do_listenter = new View.OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

    }
};
}

Please tell me where i am going wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:09:13+00:00Added an answer on June 11, 2026 at 9:09 pm

    Please follow the below link

    Get filename and path from URI from mediastore

    It’s showing error because you are not converting the content path into real path.

    It works for me.

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to upload video on cdn server(hwcdn.net server) through api, but getting
I am trying to upload video to Wordpress.using following method string expression = videoData.VideoTitle;
I am trying to upload video on Facebook. But my code is not working:
I am trying to upload a youtube video using the GData gem (I have
We are getting error when trying to upload a large size video file to
I'm trying to upload pdf files in the server. And i;m using the following
Iam trying to upload the video but when file uploads the following response displays
I am trying to upload video from the iPhone application using FBConnect. Actually I
I’m trying to upload a video of size 100MB through Asset Library. But when
I am using wamp as my test server and when trying to upload videos

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.