Skype4J icon indicating copy to clipboard operation
Skype4J copied to clipboard

Problem of transferring file via Skype

Open tanhopham1990 opened this issue 6 years ago • 2 comments

Hi guys, I have a problem while running the code:

public static void sendSkypeFile(String username, String password, String identity, File file){ Skype skype = new SkypeBuilder(username, password).withAllResources().build(); try { skype.login(); Chat chat = skype.loadChat(identity); chat.sendFile(file); System.out.println("File sent!"); skype.logout(); } catch (ConnectionException e) { e.printStackTrace(); } }

The error throws: com.samczsun.skype4j.exceptions.ConnectionException: While uploading data (400 Bad Request) at com.samczsun.skype4j.internal.ExceptionHandler.generateException(ExceptionHandler.java:50) at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.connect(Endpoints.java:372) at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.connect(Endpoints.java:302) at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.post(Endpoints.java:286) at com.samczsun.skype4j.internal.Utils.upload(Utils.java:69) at com.samczsun.skype4j.internal.chat.ChatImpl.sendFile(ChatImpl.java:145)

Please show me why and how to resolve it. I will appreciate all your helps! Thanks

tanhopham1990 avatar Aug 31 '18 03:08 tanhopham1990

Try having a look over this https://github.com/OllieTerrance/SkPy/issues/82 Looks like you need to add an additional header to the request

metasonic avatar Sep 03 '18 08:09 metasonic

Hi, I am facing the same issue. Sending messages works, but not files. I am getting the same error as @tanhopham1990

iskrenyp avatar Oct 31 '18 13:10 iskrenyp