Saving a file after upload

I’m trying to save a file by gallery choice, I’ve managed to save the file into files but I’m having problems saving the URL into “Posts” table on my backendless database. When I run the app I get the Toast “FAILED ON SAVING POST”.

++ I’m trying to set a relation too, don’t know if that’s a problem for now.

Backendless.Files.upload(file, imagesLink, new AsyncCallback() {
@Override
public void handleResponse(BackendlessFile response) {
Toast.makeText(PostActivity.this, “Done!”, Toast.LENGTH_SHORT).show();
HashMap post = new HashMap();
post.put(“name”, userName);
post.put(“postpic”, response.getFileURL());

                Backendless.Data.of("Posts").save(post, new AsyncCallback<Map>() {
                    @Override
                    public void handleResponse(Map response) {
                        Toast.makeText(PostActivity.this, "Post SAVED!", Toast.LENGTH_SHORT).show();

                        HashMap<String, Object> child = new HashMap<>();
                        child.put("objectId", response.get("objectId").toString());

                        HashMap<String, Object> parent = new HashMap<>();
                        parent.put("objectId", "554EFBE1-0B99-BCFE-FF29-D8D51B46AF00");

                        ArrayList<Map> childArray = new ArrayList<>();
                        childArray.add(child);

                        Backendless.Persistence.of("Feed").setRelation(parent, "posts", childArray, new AsyncCallback<Integer>() {
                            @Override
                            public void handleResponse(Integer response) {
                                Toast.makeText(PostActivity.this, "OMG POST LINKED", Toast.LENGTH_SHORT).show();
                            }

                            @Override
                            public void handleFault(BackendlessFault fault) {
                                Toast.makeText(PostActivity.this, "ERROOOOOOOR NOT LINKED", Toast.LENGTH_SHORT).show();
                            }
                        });

                    }

                    @Override
                    public void handleFault(BackendlessFault fault) {
                        Toast.makeText(PostActivity.this, "FAILED ON SAVING POST", Toast.LENGTH_SHORT).show();
                    }
                });
            }

            @Override
            public void handleFault(BackendlessFault fault) {
                Toast.makeText(PostActivity.this, "dead!", Toast.LENGTH_SHORT).show();
            }
        });

Hello @Alexandre_Coutinho

Change this out info for fault

@Override
 public void handleFault(BackendlessFault fault) {
    Toast.makeText(PostActivity.this, "FAILED ON SAVING POST", Toast.LENGTH_SHORT).show();
}

to show fault.getExtendedData() + fault.getMessage() + fault.getDetail() + fault.getCode() and write here what gives.

Ok fixed it, the only thing wrong was that on the database I was trying to save the postpic as an Int, changing that into a string url fixed it! Thanks :wink: