How to get files from PHP server?

394 Views Asked by At

I am sending FileBody to server by using MultiPartentity.It's uploaded successfully in server.But i don't know how to download(GET) that file from PHP Server.

Here is my code for sending FileBody to server.

This is for adding audiofile path into FileBody

String filepath = Environment.getExternalStorageDirectory()
                .getPath() + "WorkDetailAudio.wav";
File audioFile = new File(filepath);
ContentBody cbFile = new FileBody(audioFile,"audio/*");

This is for sending audioFile into server...

MultipartEntity entity = new MultipartEntity(
            HttpMultipartMode.BROWSER_COMPATIBLE);
if (audioRecorded == true) {
    entity.addPart(RequestParameter.JOB_AUDIO, audioCbFile1);
} else {
    entity.addPart(RequestParameter.JOB_AUDIO, new StringBody(""));
}

Here i am getting one problem if i am sending audiofile first time with path.If the

audiorecord = true;

the audio file is sending succesfully.If i am sending entity without audiofile second time.In server it's showing audiofile.As per entity here i am sending StringBody("") with null value.But in server it's showing file,it's not showing null value..

And How to get a file from server..

Any one please guide me.......

0

There are 0 best solutions below