Note that there are some explanatory texts on larger screens.

plurals
  1. PO"invalid parameter" error in android
    primarykey
    data
    text
    <p>i am trying to upload a file in Php server.the server accepts a request containing Userid,password and a video file.</p> <p>following is server side code.</p> <pre><code>public function uploadVideoAction(Request $request) { $tranlator = $this-&gt;get('translator'); $sUserName = $request-&gt;request-&gt;get('username'); $passWord = $request-&gt;request-&gt;get('password'); if(empty($sUserName) || empty($passWord) || empty($_FILES['video_profile_candidate'])) { $view = View::create() -&gt;setStatusCode(400) -&gt;setData(array( 'message' =&gt; $tranlator-&gt;trans('Invalid parameters') )); return $this-&gt;get('fos_rest.view_handler')-&gt;handle($view); } </code></pre> <p>when ever i am trying to send the request from android through HttpPost getting an "invalid Parameter" error. can anyone help me out.</p> <p>here is my android code</p> <pre><code>JSONObject jsonObject = new JSONObject(); try { jsonObject.put(CommonString.LOGIN_USER_NAME,"username"); jsonObject.put(CommonString.LOGIN_PASSWORD,"####"); System.out.println("object "+jsonObject); } catch (JSONException e) { e.printStackTrace(); } HttpClient httpClient = new DefaultHttpClient(); HttpPost httpost = new HttpPost("url"); Log.i(TAG, "request :url"); httpost.setHeader("Content-type", "application/x-www-urlendcode"); File file = new File(CommonString.PATH+File.separator+CommonString.VIDEO_SEND_NAME); if(file.exists()) { System.out.println("File path "+file.getAbsolutePath()); } try { FileBody filebody=new FileBody(file); MultipartEntity multipartEntity = new MultipartEntity(); multipartEntity.addPart("'password", new StringBody("password")); multipartEntity.addPart("'username", new StringBody("username")); multipartEntity.addPart("'video_profile_candidate", filebody); httpost.setEntity(multipartEntity); HttpResponse httpresponse = httpClient.execute(httpost); System.out.println("Hiii "+ httpresponse.getStatusLine().getStatusCode()); Log.i(TAG, "request"+ httpresponse.getStatusLine().getStatusCode()); } catch (Exception e) { Log.i(TAG, "Exception "+e.getMessage()); System.out.println("Exception "+e.getMessage()); } System.out.println("text "+response); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload