开发者

Error uploading file from android sdcard

开发者 https://www.devze.com 2023-02-18 02:49 出处:网络
When uploading the file from my emulators sdcard to the local wampserver I got this error. 03-22 10:46:15.459: ERROR/Debug(487): error: localhost/127.0.0.1:80 - Connection refused

When uploading the file from my emulators sdcard to the local wampserver I got this error.

03-22 10:46:15.459: ERROR/Debug(487): error: localhost/127.0.0.1:80 - Connection refused

sample code

String urlString = "http://localhost/uploads/index.php";

try
{
  //------------------ CLIENT REQUEST
  FileInputStream fileInputStream = new FileInputStream(new File(existingFileName));开发者_运维问答
  // open a URL connection to the Servlet
  URL url = new URL(urlString);

Can anybody tell me what this error means and what I have to do to avoid it?


Your issue is likely caused by the fact that the localhost name you are pointing at resides on the device and is not the host computer where the server is.

A way you could remedy this is to use the host pc's actual IP address.


You must replace "localhost" with "10.0.2.2".

0

精彩评论

暂无评论...
验证码 换一张
取 消