Skip to content Skip to sidebar Skip to footer

Video Upload In Android

I am trying to upload video to server ,here i have store the video in assets folder,and trying to upload.i have used the following code: private void uploadVideo() {

Solution 1:

Without knowing which line is 233, I'll make a guess and say that the problem line is

FileInputStreamfileInputStream=newFileInputStream(newFile(fileName));

Your filename is defined as a URI, but you're trying to create an input stream to it as a File. I suspect this input stream is null. Step through this with a debugger to confirm.

EDIT: If you want to read a file from you assets folder, use getAssets() method:

StringfileName="clip0003";
InputSteamfileInputSteam=newInputStreamReader(getAssets().open(filename));

Note that this code assumes that you're inside an Activity or other class that extends Context. If not, you'll need access to a Context and call context.getAssets().

Post a Comment for "Video Upload In Android"