I found some code that is supposed to work from stack over flow for s3
upload (shown below). However I always get this error when I try it
java.io.IOException: Error writing to server
at
sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:666)
at
sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:678)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at
com.codename1.impl.javase.JavaSEPort.getResponseCode(JavaSEPort.java:6248)
at
com.codename1.io.ConnectionRequest.performOperation(ConnectionRequest.java:403)
at
com.codename1.io.NetworkManager$NetworkThread.run(NetworkManager.java:282)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
private void doUpload()
{
try {
String strImage = Capture.capturePhoto();
String s3Bucket = "https://usaeasygazy.s3.amazonaws.com";
//usa ones are easier no redirects?
String fileName = "ARSE";
MultipartRequest rq = new MultipartRequest();
rq.setUrl(s3Bucket);
rq.addArgumentNoEncoding("key", fileName);
//rq.addArgument("acl", "public-read-write"); // here I give
read-write access
rq.addArgument("acl", "bucket-owner-full-control");
rq.addData("file", strImage, "image/jpeg");
_("add request to queue");
NetworkManager.getInstance().addToQueue(rq);
_("done");
} catch (IOException ex) {
_("ERROR DURING UPLOAD.! "+ex.getMessage());
}
}
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/2e29382f-33b9-4a60-adf4-302df1d9ec3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.