Monday, 15 September 2014

Getting undefined index 'uploadedfile' at php side while uploading pdf file with parameter from android -


I am creating an application in which I want to upload files from Android application. If I am comment parameter code, the file upload will be successful and if I comment the file upload code from the php page then the parameter will pass successfully, please help me. The following is my PHP code.

  $ flag = $ _ POST ['f']; $ File_path = "upload /"; $ File_path = $ file_path basename ($ _FILES ['uploaded file'] ['name']); If (move_uploaded_file ($ _ FILES ['uploadfile'] ['tmp_name'], $ file_path)) {echo "successfully uploaded"; } Else {echo "failed to upload"; } $ Flag echo;  

Follow my Android code.

  cn.setDoInput (true); Cn.setDoOutput (true); & Lt; NameValuePair & gt; Parameters = new arreelist & lt; Named Wolopleyre & gt; (); Params.add (new binarynamewallpayer ("F", "GAT")); OutputStream OS = cn.getOutputStream (); BufferedWriter Writer = New buffed waist (new output speed water (OS, "UTF-8"); Author.write (getQuery); Writer.flush (); Writer.close (); Os.close (); // cn.setUseCaches (wrong); Cn.setRequestMethod ("Post"); Cn.setRequestProperty ("connection", "keep-alive"); Cn.setRequestProperty ("ENCTYPE", "Multicast / Form-Data"); Cn.setRequestProperty ("Uploaded file", M_Chayon); Cn.setRequestProperty ("content-type", "multipart / form-data; limit =" + limit); DataOutputStream dos = new dataoutputstream (cn.getOutputStream ()); Dos.writeBytes (Two Hyphens + Boundary + Lineand); Dos.writeBytes ("content-displacement: post-data; name = \" uploaded file \ ", file name = \" "+ m_chosen +" \ "" + lineEnd); Dos.writeBytes (lineEnd);  


No comments:

Post a Comment