I have a txt file name data.txt and a php file named update.php at
http://www.mydomain.com/Online/outgoing/, and all the codes are shown below. But when I ran the program, I got an error, and do not know how to fix it. Can anyone help me? Any hint and guide is very appreciated. Thanks
// close the multipart form request dstream.writeBytes("\r\n--AXi93A--\r\n\r\n"); dstream.flush(); dstream.close();
// read the output from the URL try{ BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream())); String sIn = in.readLine(); boolean b = true; while(sIn!=null){ if(sIn!=null){ if(popup) if(sIn.substring(0,folder.length()).equals(folder)) link(url+sIn, "_blank"); System.out.println(sIn); } sIn = in.readLine(); } } catch(Exception e){ e.printStackTrace(); } }
if (is_uploaded_file($data)) { $newfile = $savepath."/".$folder."/".$filename; if (!copy($data, $newfile)) { // if an error occurs the file could not // be written, read or possibly does not exist echo "Error #1 Uploading File."; exit(); }else{ echo $folder."/".$filename; } } else { echo "Error #2 Uploading File."; exit(); } ?>
But after running the code, I got this error:
java.io.IOException: Server returned HTTP response code: 500 for URL:
http://www.mydomain.com/Online/outgoing/saveFile.php?title=data_20120928-233150&ext=txt&folder=http://www.mydomain.com/Online/outgoing/ at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sketch_120928b.postData(sketch_120928b.java:94)
at sketch_120928b.saveToWeb_saveFileString(sketch_120928b.java:52)
at sketch_120928b.setup(sketch_120928b.java:45)
at processing.core.PApplet.handleDraw(PApplet.java:2103)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:190)
at processing.core.PApplet.run(PApplet.java:2006)
at java.lang.Thread.run(Thread.java:662)