Skip to content

Trying to send wav file from device storage #1

@SyafiqTM

Description

@SyafiqTM

I got a response from server that tells me {"status:"failure","reason":"Not a WAVE file - no RIFF header"}.
I try to upload the sample wav provided but from my device storage.

private HttpEntity getEntityForSendFile()
	{
		File directory = Environment.getExternalStorageDirectory();
		File file = new File( directory + "/AudioRecorder" );
		File AudioSavePathInDevice = new File( file + "/sample.wav" );
		InputStreamEntity reqEntity = null;
		// Fetches file from local resources.

		/*InputStream raw = getResources().openRawResource(R.raw.sample);*/
		try{
			InputStream raw = new FileInputStream(AudioSavePathInDevice);
			reqEntity = new InputStreamEntity(raw, -1);
		}catch (Exception e) {
			e.printStackTrace();
		}

		return reqEntity;
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions