3

I want to upload file to server in android ,i am using the same code given here but when i run the code i get a : java.net.SocketException:Permission Denied exception at line:
dos = new DataOutputStream(conn.getOutputStream());

EDITED:

one thing more that if a server requires authentication (means if the server requires some username and password to log in first and only then you can upload the files example:Amazon s3 ) then what changes i have to make in the same code.

what should i do.please help.

Thanks

Community
  • 1
  • 1
Tushar Agarwal
  • 521
  • 1
  • 16
  • 39

3 Answers3

1

Add this line to your app manifest

<uses-permission android:name="android.permission.INTERNET" />
Anton
  • 4,395
  • 7
  • 32
  • 46
1

have you added internet permission to you manifest file?

<manifest xlmns:android>
     <uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

I think the problem lies there

J. Maes
  • 6,862
  • 5
  • 27
  • 33
1

You should add the permission of INTERNET to make sure your application can upload your file to server. add this in your manifest:

<uses-permission android:name="android.permission.INTERNET" />
lanyimo
  • 367
  • 1
  • 3
  • 13