Upload a file to a server using gotev

0

I have a problem in which the progress bar is shown and it ends up normal in the application but at the time of viewing the uploaded files it does not appear on the server and the app does not show upload error so this is my code:

         public void UploadFiel(final Context c, String path){
                try {
        String nombre;
        String separador="/";
        String[] arrayList=path.split(separador);
        nombre = arrayList[arrayList.length - 1];
        Usuario usuario=new Usuario();
        String ID= UUID.randomUUID().toString();
        String URL="http://ftpky.ramdomus.com/Clientes/"+usuario.getEmail();
        Log.e("URL: ",URL);
        new MultipartUploadRequest(c,ID,URL)
                .addFileToUpload(path,"file")
                .addParameter("filename",nombre)
                .setMaxRetries(2)
                .setDelegate(new UploadStatusDelegate() {
                    @Override
                    public void onProgress(UploadInfo uploadInfo) {

                    }

                    @Override
                    public void onError(UploadInfo uploadInfo, Exception exception) {
                        Toast.makeText(c,"Error: "+String.valueOf(exception.getCause()),Toast.LENGTH_LONG).show();
                        Toast.makeText(c,"Info:"+ String.valueOf(uploadInfo),Toast.LENGTH_LONG).show();
                    }

                    @Override
                    public void onCompleted(UploadInfo uploadInfo, ServerResponse serverResponse) {
                        Toast.makeText(c,"Mensaje: "+String.valueOf(serverResponse),Toast.LENGTH_LONG).show();
                        Toast.makeText(c,"Info:"+ String.valueOf(uploadInfo),Toast.LENGTH_LONG).show();
                    }

                    @Override
                    public void onCancelled(UploadInfo uploadInfo) {

                    }
                }).setNotificationConfig(new UploadNotificationConfig())
                .startUpload();
    }catch (Exception e){
        Log.e("Error: ",e.getMessage());
    }
}
    
asked by emilio paredes 27.03.2018 в 23:42
source

0 answers