Can't be sure without looking at your entire implementation but here are 2 ideas:
1- make sure to add the file via MultipartRequest.addData( and don't call setPost or setFileName 2- make sure your test call in Postman is using Multipart https://stackoverflow.com/questions/16015548/how-to-send-multipart-form-data-request-using-postman On Wed, 30 Jun 2021 at 03:22, [email protected] <[email protected]> wrote: > Hi, > > I asked him about the arguments because I did not get the ws to recognize > them > > El Tuesday, June 29, 2021 a la(s) 8:33:36 PM UTC-5, Shai Almog escribió: > >> Hi, >> using the regular addArgument should work just fine. It will be added to >> the multipart seamlessly. >> >> On Wednesday, June 30, 2021 at 3:15:35 AM UTC+3 [email protected] wrote: >> >>> Hi, >>> >>> Detect the problem by including the following parameters: >>> mp.setFilename ("image", "data.jpeg"); >>> mp.setPost (true); >>> >>> However, I would like to know how I can send 2 additional arguments >>> (Database and Company Number). >>> >>> Thanks >>> >>> >>> El Tuesday, June 29, 2021 a la(s) 6:37:59 PM UTC-5, [email protected] >>> escribió: >>> >>>> Hi, >>>> >>>> I am working on a WS made in PHP. I was able to create some routines to >>>> receive an image and save them in a folder on the server. All this I have >>>> been testing in Postman and it works 100%. >>>> In the WS I do not validate the HTTP method, but I assume it is POST. >>>> >>>> From my mobile app I send the file with the MultipartRequest class. I >>>> was able to validate by debugging the response code 200, however I can't >>>> get the file to be created in the folder. >>>> >>>> I have 3 days struggling with this and I don't see the problem. I copy >>>> the code to see if you can see the error. >>>> >>>> I take this opportunity to ask if it is valid to send additional >>>> arguments, since I need to send the name of the database and the company >>>> code to create the folder where the image will be saved. >>>> >>>> My code: >>>> public static void actualizaImagenFoto(String rutaImagen, Long >>>> visitaId) { >>>> try { >>>> MultipartRequest mp = new MultipartRequest(); >>>> mp.setUrl(SERVER_URL + "ws_foto_imagen/ws_foto_imagen.php"); >>>> // mp.addArgument("token", UsuarioService.getToken()); >>>> // mp.addArgument("fot_visita_id", visitaId.toString()); >>>> mp.addData("imagen", rutaImagen, "image/jpeg"); >>>> addToQueue(mp); >>>> System.out.println(Integer.toString(mp.getResponseCode()) + >>>> " " + mp.getResponseErrorMessage()); >>>> } catch (IOException err) { >>>> Log.e(err); >>>> ToastBar.showErrorMessage("Error en actualización de la >>>> foto: " + err.getMessage()); >>>> } >>>> } >>>> >>> -- > You received this message because you are subscribed to the Google Groups > "CodenameOne Discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/codenameone-discussions/2320c9e6-4b91-412c-b04f-55ba6587c88cn%40googlegroups.com > <https://groups.google.com/d/msgid/codenameone-discussions/2320c9e6-4b91-412c-b04f-55ba6587c88cn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/CAG90yJ3KGPr7JxKMHLXHbXeSpUqjyPU%3D%2BTs3Cc8r_2KqjbUyww%40mail.gmail.com.
