org.apache.http.entity.mime.MultipartEntity Java Examples
The following examples show how to use
org.apache.http.entity.mime.MultipartEntity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixtureCloud.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
private void uploadMixtureCloud() throws Exception { uploadInitialising(); responseString = NUHttpClientUtils.getData("https://www.mixturecloud.com/files", httpContext); uploadUrl = "http:" + StringUtils.stringBetweenTwoStrings(responseString, "urlUpload : '", "',"); NULogger.getLogger().log(Level.INFO, "uploadUrl is {0}", uploadUrl); httpPost = new NUHttpPost(uploadUrl); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("cmd", new StringBody("upload")); mpEntity.addPart("target", new StringBody("mcm1_MA")); mpEntity.addPart("upload[]", createMonitoredFileBody()); httpPost.setEntity(mpEntity); uploading(); httpResponse = httpclient.execute(httpPost, httpContext); HttpEntity resEntity = httpResponse.getEntity(); responseString = EntityUtils.toString(resEntity); //NULogger.getLogger().log(Level.INFO, "stringResponse : {0}", responseString); JSONObject jSonObject = new JSONObject(responseString); String webAccess = jSonObject.getJSONArray("file_data").getJSONObject(0).getString("web_access"); downloadUrl += webAccess; downURL = downloadUrl; }
Example #2
Source File: WuploadUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
public static void fileUpload() throws IOException { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); file = new File("/home/vigneshwaran/dinesh.txt"); HttpPost httppost = new HttpPost(postURL); httppost.setHeader("Cookie", langcookie + ";" + sessioncookie + ";" + mailcookie + ";" + namecookie + ";" + rolecookie + ";" + orderbycookie + ";" + directioncookie + ";"); MultipartEntity mpEntity = new MultipartEntity(); ContentBody cbFile = new FileBody(file); mpEntity.addPart("files[]", cbFile); httppost.setEntity(mpEntity); System.out.println("Now uploading your file into wupload..........................."); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); System.out.println(response.getStatusLine()); if (response.getStatusLine().getStatusCode() == 302 && response.getFirstHeader("Location").getValue().contains("upload/done/")) { System.out.println("Upload successful :)"); } else { System.out.println("Upload failed :("); } }
Example #3
Source File: MultiPartTestCase.java From quarkus-http with Apache License 2.0 | 6 votes |
@Test public void testMultiPartIndividualFileToLarge() throws IOException { TestHttpClient client = new TestHttpClient(); try { String uri = DefaultServer.getDefaultServerURL() + "/servletContext/3"; HttpPost post = new HttpPost(uri); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("formValue", new StringBody("myValue", "text/plain", StandardCharsets.UTF_8)); entity.addPart("file", new FileBody(new File(MultiPartTestCase.class.getResource("uploadfile.txt").getFile()))); post.setEntity(entity); HttpResponse result = client.execute(post); final String response = HttpClientUtils.readResponse(result); Assert.assertEquals("EXCEPTION: class java.lang.IllegalStateException", response); } finally { client.getConnectionManager().shutdown(); } }
Example #4
Source File: ZippyShare.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
private void fileUpload() throws Exception { httpPost = new NUHttpPost(postURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("Filename", new StringBody(file.getName())); mpEntity.addPart("notprivate", new StringBody("false")); mpEntity.addPart("folder", new StringBody("/")); mpEntity.addPart("Filedata", createMonitoredFileBody()); httpPost.setHeader("Cookie", usercookie); httpPost.setEntity(mpEntity); uploading(); NULogger.getLogger().info("Now uploading your file into zippyshare.com"); httpResponse = httpclient.execute(httpPost); gettingLink(); HttpEntity resEntity = httpResponse.getEntity(); if (resEntity != null) { uploadresponse = EntityUtils.toString(resEntity); downloadlink = StringUtils.stringBetweenTwoStrings(uploadresponse, "value=\"http://", "\""); downloadlink = "http://" + downloadlink; NULogger.getLogger().log(Level.INFO, "Download Link : {0}", downloadlink); downURL=downloadlink; }else{ throw new Exception("ZippyShare server problem or Internet connectivity problem"); } }
Example #5
Source File: GigaSize.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
public void fileUpload() throws Exception { httpPost = new NUHttpPost("http://www.gigasize.com/uploadie"); MultipartEntity mpEntity = new MultipartEntity(); mpEntity.addPart("UPLOAD_IDENTIFIER", new StringBody(uploadid)); mpEntity.addPart("sid", new StringBody(sid)); mpEntity.addPart("fileUpload1", createMonitoredFileBody()); httpPost.setEntity(mpEntity); uploading(); NULogger.getLogger().info("Now uploading your file into Gigasize..........................."); HttpResponse response = httpclient.execute(httpPost, httpContext); HttpEntity resEntity = response.getEntity(); NULogger.getLogger().info(response.getStatusLine().toString()); if (resEntity != null) { sid = ""; sid = EntityUtils.toString(resEntity); NULogger.getLogger().log(Level.INFO, "After upload sid value : {0}", sid); } else { throw new Exception("There might be a problem with your internet connection or GigaSize server problem. Please try after some time :("); } }
Example #6
Source File: MediaFireUploadPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
public static void fileUpload() throws IOException { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost httppost = new HttpPost(postURL); File file = new File("d:/hai.html"); System.out.println(ukeycookie); httppost.setHeader("Cookie", ukeycookie + ";" + skeycookie + ";" + usercookie); MultipartEntity mpEntity = new MultipartEntity(); ContentBody cbFile = new FileBody(file); mpEntity.addPart("", cbFile); httppost.setEntity(mpEntity); System.out.println("Now uploading your file into mediafire..........................."); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); System.out.println(response.getStatusLine()); if (resEntity != null) { System.out.println("Getting upload response key value.........."); uploadresponsekey = EntityUtils.toString(resEntity); getUploadResponseKey(); System.out.println("upload resoponse key " + uploadresponsekey); } }
Example #7
Source File: DivShareUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
private static void fileUpload() throws Exception { file = new File("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.jpg"); httpclient = new DefaultHttpClient(); //http://upload3.divshare.com/cgi-bin/upload.cgi?sid=8ef15852c69579ebb2db1175ce065ba6 HttpPost httppost = new HttpPost(downURL + "cgi-bin/upload.cgi?sid=" + sid); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); ContentBody cbFile = new FileBody(file); mpEntity.addPart("file[0]", cbFile); httppost.setEntity(mpEntity); System.out.println("executing request " + httppost.getRequestLine()); System.out.println("Now uploading your file into divshare.com"); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); System.out.println(response.getStatusLine()); System.out.println(EntityUtils.toString(resEntity)); }
Example #8
Source File: UploadBoxUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
private static void fileUpload() throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(postURL); httppost.setHeader("Cookie", sidcookie); file = new File("h:/install.txt"); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); ContentBody cbFile = new FileBody(file); mpEntity.addPart("filepc", cbFile); mpEntity.addPart("server", new StringBody(server)); httppost.setEntity(mpEntity); System.out.println("executing request " + httppost.getRequestLine()); System.out.println("Now uploading your file into uploadbox.com"); HttpResponse response = httpclient.execute(httppost); System.out.println(response.getStatusLine()); uploadresponse = response.getLastHeader("Location").getValue(); uploadresponse = getData(uploadresponse); downloadlink = parseResponse(uploadresponse, "name=\"loadlink\" id=\"loadlink\" class=\"text\" onclick=\"this.select();\" value=\"", "\""); deletelink = parseResponse(uploadresponse, "name=\"deletelink\" id=\"deletelink\" class=\"text\" onclick=\"this.select();\" value=\"", "\""); System.out.println("Download link " + downloadlink); System.out.println("deletelink : " + deletelink); }
Example #9
Source File: ScribdUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private static void fileUpload() throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); // int Min = 1, Max = 10; //Min + (int)(Math.random() * ((Max - Min) + 1)) //1+(int)(Math.random() * ((10 - 1) + 1)) //1+(int)(Math.random() * 10) // int k = 1 + (int) (Math.random() * 10);a File f = new File("E:/Projects/NU/NeembuuUploader/test/neembuuuploader/test/plugins/BayFilesUploaderPlugin.java"); HttpPost httppost = new HttpPost("http://api.scribd.com/api?method=docs.upload&api_key=5t8cd1k0ww3iupw31bb2a&Session_key=" + session_key); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); FileBody bin = new FileBody(f); reqEntity.addPart("file", bin); httppost.setEntity(reqEntity); System.out.println("Now uploading your file into scribd........ Please wait......................"); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { doc_id = EntityUtils.toString(resEntity); System.out.println(doc_id); if (doc_id.contains("stat=\"ok\"")) { doc_id = parseResponse(doc_id, "<doc_id>", "</doc_id>"); System.out.println("doc id :" + doc_id); } else { throw new Exception("There might be problem with your internet connection or server error. Please try again some after time :("); } } else { throw new Exception("There might be problem with your internet connection or server error. Please try again some after time :("); } }
Example #10
Source File: FileFactoryUploadPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
public static void fileUpload() throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://upload.filefactory.com/upload.php"); // httppost.setHeader("Cookie", cookie + ";" + membershipcookie); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); //reqEntity.addPart("string_field",new StringBody("field value")); File f = new File("/home/vigneshwaran/Documents/TNEB Online Payment 3.pdf"); FileBody bin = new FileBody(f); reqEntity.addPart("Filedata", bin); System.out.println(URLDecoder.decode(membershipcookie, "UTF-8")); reqEntity.addPart("cookie", new StringBody(URLDecoder.decode(membershipcookie, "UTF-8"))); reqEntity.addPart("Filename", new StringBody(f.getName())); reqEntity.addPart("folderViewhash", new StringBody("0")); // reqEntity.addPart("upload", new StringBody("Submit Query")); httppost.setEntity(reqEntity); System.out.println("Now uploading your file into filefactory.com. Please wait......................"); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); String page = ""; if (resEntity != null) { page = EntityUtils.toString(resEntity); System.out.println("PAGE :" + page); } //http://www.filefactory.com/file/complete.php/6nseodiow47d/ downloadlink = getData("http://www.filefactory.com/file/complete.php/" + page); downloadlink = downloadlink.substring(downloadlink.indexOf("<div class=\"innerText\">")); downloadlink = downloadlink.replace("<div class=\"innerText\">", ""); downloadlink = downloadlink.substring(0, downloadlink.indexOf("</p>")); downloadlink = downloadlink.substring(downloadlink.indexOf("<p>")); downloadlink=downloadlink.replaceAll("<p>",""); System.out.println("Download Link : " + downloadlink); }
Example #11
Source File: FileServe.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
public void fileUpload() throws Exception { uploading(); httpPost = new NUHttpPost(postURL); MultipartEntity mpEntity = new MultipartEntity(); mpEntity.addPart("files", createMonitoredFileBody()); httpPost.setEntity(mpEntity); NULogger.getLogger().info("Now uploading your file into fileserve..........................."); httpResponse = httpclient.execute(httpPost, httpContext); HttpEntity resEntity = httpResponse.getEntity(); NULogger.getLogger().info(httpResponse.getStatusLine().toString()); if (resEntity != null) { stringResponse = EntityUtils.toString(resEntity); NULogger.getLogger().log(Level.INFO, "upload response : {0}", stringResponse); gettingLink(); String shortencode = StringUtils.stringBetweenTwoStrings(stringResponse, "\"shortenCode\":\"", "\""); String fileName = StringUtils.stringBetweenTwoStrings(stringResponse, "\"fileName\":\"", "\""); String deleteCode = StringUtils.stringBetweenTwoStrings(stringResponse, "\"deleteCode\":\"", "\""); downloadlink = "http://www.fileserve.com/file/" + shortencode + "/" + fileName; deletelink = "http://www.fileserve.com/file/" + shortencode + "/delete/" + deleteCode; NULogger.getLogger().log(Level.INFO, "Download Link : {0}", downloadlink); NULogger.getLogger().log(Level.INFO, "Delete Link : {0}", deletelink); downURL = downloadlink; delURL = deletelink; } else { throw new Exception("There might be a problem with your internet connection or server error. Please try again later :("); } }
Example #12
Source File: RapidShare.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
public void fileUpload() throws Exception { httpPost = new NUHttpPost(postURL); MultipartEntity mpEntity = new MultipartEntity(); mpEntity.addPart("sub", new StringBody("upload")); mpEntity.addPart("cookie", new StringBody(RapidShareAccount.getRscookie())); mpEntity.addPart("folder", new StringBody("0")); mpEntity.addPart("filecontent", createMonitoredFileBody()); httpPost.setEntity(mpEntity); uploading(); NULogger.getLogger().info("Now uploading your file into rs..........................."); httpResponse = httpclient.execute(httpPost, httpContext); HttpEntity resEntity = httpResponse.getEntity(); NULogger.getLogger().info(httpResponse.getStatusLine().toString()); if (resEntity != null) { gettingLink(); uploadresponse = EntityUtils.toString(resEntity); NULogger.getLogger().log(Level.INFO, "Actual response : {0}", uploadresponse); uploadresponse = uploadresponse.replace("COMPLETE\n", ""); // downloadid=uploadresponse.substring(uploadresponse.indexOf("E")+1); downloadid = uploadresponse.substring(0, uploadresponse.indexOf(",")); uploadresponse = uploadresponse.replace(downloadid + ",", ""); filename = uploadresponse.substring(0, uploadresponse.indexOf(",")); NULogger.getLogger().log(Level.INFO, "download id : {0}", downloadid); // filename=uploadresponse.substring(uploadresponse.indexOf(",")); // filename=uploadresponse.substring(0, uploadresponse.indexOf(",")); NULogger.getLogger().log(Level.INFO, "File name : {0}", filename); downloadlink = "http://rapidshare.com/files/" + downloadid + "/" + filename; NULogger.getLogger().log(Level.INFO, "Download Link :{0}", downloadlink); downURL = downloadlink; uploadFinished(); } }
Example #13
Source File: UploadingdotcomUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private static void fileUpload() throws IOException { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(postURL); // httppost.setHeader("Accept", "text/*"); // httppost.setHeader("User-Agent", "Shockwave Flash"); // httppost.setHeader("Connection", "Keep-Alive"); // httppost.setHeader("Pragma", "no-cache"); httppost.setHeader("Cookie", sidcookie + ";" + timecookie + ";" + cachecookie + ";" + ucookie); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); reqEntity.addPart("Filename", new StringBody(file.getName())); reqEntity.addPart("folder_id", new StringBody("0")); reqEntity.addPart("SID", new StringBody(sid)); reqEntity.addPart("file", new StringBody(fileID)); FileBody bin = new FileBody(file); reqEntity.addPart("file", bin); reqEntity.addPart("upload", new StringBody("Submit Query")); httppost.setEntity(reqEntity); System.out.println("Now uploading your file into uploading.com. Please wait......................"); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { uploadresponse = EntityUtils.toString(resEntity); System.out.println("PAGE :" + uploadresponse); uploadresponse = parseResponse(uploadresponse, "answer\":\"", "\""); } }
Example #14
Source File: ShareSend.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private boolean getUploadUrl() throws UnsupportedEncodingException, IOException, Exception{ String contentType = FileUtils.getContentType(file); FileInputStream fis = new FileInputStream(file); //NULogger.getLogger().log(Level.INFO, "Content type: {0}", contentType); httpPost = new NUHttpPost("http://sharesend.com/api/get_upload_url"); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("name", new StringBody(file.getName())); mpEntity.addPart("content_type", new StringBody(contentType)); mpEntity.addPart("size", new StringBody(Long.toString(file.length()))); mpEntity.addPart("hash", new StringBody(DigestUtils.sha256Hex(fis))); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); httpResponse = httpclient.execute(httpPost, httpContext); stringResponse = EntityUtils.toString(httpResponse.getEntity()); //FileUtils.saveInFile("ShareSend.html", stringResponse); jsonObject = new JSONObject(stringResponse); if(jsonObject.has("error")){ //Handle errors status = UploadStatus.GETTINGERRORS; throw new Exception(jsonObject.getString("error")); } else{ if(jsonObject.has("token")){ gettingLink(); uploadProgress.set(100); downURL = "http://sharesend.com/" + jsonObject.getString("token"); return true; } else{ uploadUrl = jsonObject.getString("upload_url"); } } return false; }
Example #15
Source File: MultipartFormDataParserTestCase.java From quarkus-http with Apache License 2.0 | 5 votes |
@Test public void testFileUploadWithMediumFileSizeThresholdAndLargeFile() throws Exception { int fileSizeThreshold = 1000; DefaultServer.setRootHandler(new BlockingHandler(createInMemoryReadingHandler(fileSizeThreshold))); TestHttpClient client = new TestHttpClient(); File file = new File("tmp_upload_file.txt"); file.createNewFile(); try { writeLargeFileContent(file, fileSizeThreshold * 2); HttpPost post = new HttpPost(DefaultServer.getDefaultServerURL() + "/path"); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("formValue", new StringBody("myValue", "text/plain", StandardCharsets.UTF_8)); entity.addPart("file", new FileBody(file)); post.setEntity(entity); HttpResponse result = client.execute(post); Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); String resp = HttpClientUtils.readResponse(result); Map<String, String> parsedResponse = parse(resp); Assert.assertEquals("false", parsedResponse.get("in_memory")); Assert.assertEquals("tmp_upload_file.txt", parsedResponse.get("file_name")); Assert.assertEquals(DigestUtils.md5Hex(new FileInputStream(file)), parsedResponse.get("hash")); } finally { file.delete(); client.getConnectionManager().shutdown(); } }
Example #16
Source File: BayFiles.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void fileUpload() throws Exception { HttpPost httpPost = new HttpPost(postURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("file", createMonitoredFileBody()); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); uploading(); NULogger.getLogger().info("Now uploading your file into bayfiles.com"); HttpResponse response = httpclient.execute(httpPost); gettingLink(); uploadresponse = EntityUtils.toString(response.getEntity()); NULogger.getLogger().info(response.getStatusLine().toString()); // // NULogger.getLogger().log(Level.INFO, "Upload response : {0}", uploadresponse); jSonOjbject = new JSONObject(uploadresponse); downloadlink = jSonOjbject.getString("downloadUrl"); deletelink = jSonOjbject.getString("deleteUrl"); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink); downURL = downloadlink; delURL = deletelink; uploadFinished(); }
Example #17
Source File: HttpUtils.java From jmeter-bzm-plugins with Apache License 2.0 | 5 votes |
/** * Create Post Request with FormBodyPart body */ public HttpPost createPost(String uri, LinkedList<FormBodyPart> partsList) { HttpPost postRequest = new HttpPost(uri); MultipartEntity multipartRequest = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); for (FormBodyPart part : partsList) { multipartRequest.addPart(part); } postRequest.setEntity(multipartRequest); return postRequest; }
Example #18
Source File: MultiPartTestCase.java From quarkus-http with Apache License 2.0 | 5 votes |
@Test public void testMultiPartRequestWithAddedServlet() throws IOException { TestHttpClient client = new TestHttpClient(); try { String uri = DefaultServer.getDefaultServerURL() + "/servletContext/added"; HttpPost post = new HttpPost(uri); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("formValue", new StringBody("myValue", "text/plain", StandardCharsets.UTF_8)); entity.addPart("file", new FileBody(new File(MultiPartTestCase.class.getResource("uploadfile.txt").getFile()))); post.setEntity(entity); HttpResponse result = client.execute(post); Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); final String response = HttpClientUtils.readResponse(result); Assert.assertEquals("PARAMS:\n" + "name: formValue\n" + "filename: null\n" + "content-type: null\n" + "Content-Disposition: form-data; name=\"formValue\"\n" + "size: 7\n" + "content: myValue\n" + "name: file\n" + "filename: uploadfile.txt\n" + "content-type: application/octet-stream\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"uploadfile.txt\"\n" + "Content-Type: application/octet-stream\n" + "size: 13\n" + "content: file contents\n", response); } finally { client.getConnectionManager().shutdown(); } }
Example #19
Source File: UploadingDotCom.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void fileUpload() throws Exception { //httpClient = new DefaultHttpClient(); httpPost = new NUHttpPost(postURL); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); reqEntity.addPart("Filename", new StringBody(getFileName())); reqEntity.addPart("SID", new StringBody(sid)); reqEntity.addPart("folder_id", new StringBody("0")); reqEntity.addPart("file", new StringBody(fileID)); reqEntity.addPart("file", createMonitoredFileBody()); reqEntity.addPart("upload", new StringBody("Submit Query")); httpPost.setEntity(reqEntity); uploading(); NULogger.getLogger().info("Now uploading your file into uploading.com. Please wait......................"); HttpResponse response = httpClient.execute(httpPost, httpContext); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { gettingLink(); uploadresponse = EntityUtils.toString(resEntity); NULogger.getLogger().log(Level.INFO, "PAGE :{0}", uploadresponse); uploadresponse = StringUtils.stringBetweenTwoStrings(uploadresponse, "answer\":\"", "\""); downURL = downloadlink; uploadFinished(); } else { throw new Exception("There might be a problem with your internet connection or server error. Please try after some time :("); } }
Example #20
Source File: UpBoothUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private static void fileUpload() throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://upbooth.com/uploadHandler.php?r=upbooth.com&p=http?aff=1db2f3b654350bf4"); httppost.addHeader("Cookie", fileHostingCookie); file = new File("c:/Dinesh/Naruto_Face.jpg"); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); ContentBody cbFile = new FileBody(file); String cookie = fileHostingCookie.substring(fileHostingCookie.indexOf("=") + 1); cookie = cookie.substring(0, cookie.indexOf(";")); System.out.println(cookie); mpEntity.addPart("=_sessionid", new StringBody(cookie)); mpEntity.addPart("files[]", cbFile); httppost.setEntity(mpEntity); System.out.println("executing request " + httppost.getRequestLine()); System.out.println("Now uploading your file into upbooth.com"); HttpResponse response = httpclient.execute(httppost); // HttpEntity resEntity = response.getEntity(); String uploadresponse = EntityUtils.toString(response.getEntity()); System.out.println(response.getStatusLine()); // if (resEntity != null) { // uploadresponse = EntityUtils.toString(resEntity); // } // System.out.println("Upload response : " + uploadresponse); String downloadlink = parseResponse(uploadresponse, "\"url\":\"", "\""); downloadlink = downloadlink.replaceAll("\\\\", ""); String deletelink = parseResponse(uploadresponse, "\"delete_url\":\"", "\""); deletelink = deletelink.replaceAll("\\\\", ""); System.out.println("Download link : " + downloadlink); System.out.println("Delete link : " + deletelink); }
Example #21
Source File: UploadedDotTo.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void fileUpload() throws Exception { httpPost = new NUHttpPost(postURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("Filename", new StringBody(file.getName())); mpEntity.addPart("Filedata", createMonitoredFileBody()); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into uploaded.net"); uploading(); httpResponse = httpclient.execute(httpPost, httpContext); gettingLink(); HttpEntity resEntity = httpResponse.getEntity(); NULogger.getLogger().info(httpResponse.getStatusLine().toString()); if (resEntity != null) { uploadresponse = EntityUtils.toString(resEntity); } // NULogger.getLogger().log(Level.INFO, "Upload response : {0}", uploadresponse); uploadresponse = uploadresponse.substring(0, uploadresponse.indexOf(",")); // changed to a descriptive/long download link (user-requested-feature) //Paralytic (01-AUG-2014) downloadlink = "http://uploaded.net/file/" + uploadresponse + "/" + file.getName(); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); downURL = downloadlink; uploadFinished(); }
Example #22
Source File: SpeedyShareUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private static void fileUpload() throws IOException { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(uploadURL); httppost.setHeader("Cookie", scookie); file = new File("/media/backup/Projects/NU/NeembuuUploader/test/neembuuuploader/test/plugins/DropBoxUploaderPlugin.java"); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); ContentBody cbFile = new FileBody(file); // mpEntity.addPart("Filename", new StringBody(file.getName())); // mpEntity.addPart("PHPSESSID", new StringBody(dataid)); mpEntity.addPart("upload", cbFile); httppost.setEntity(mpEntity); System.out.println("executing request " + httppost.getRequestLine()); System.out.println("Now uploading your file into speedyshare.com"); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); // uploadresponse = response.getLastHeader("Location").getValue(); System.out.println("Upload response : " + EntityUtils.toString(response.getEntity())); System.out.println(response.getStatusLine()); // if (resEntity != null) { // uploadresponse = EntityUtils.toString(resEntity); // } // if (resEntity != null) { // resEntity.consumeContent(); // } // System.out.println("res " + uploadresponse); httpclient.getConnectionManager().shutdown(); }
Example #23
Source File: FileDenUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private static void fileUpload() throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.fileden.com/upload_old.php"); httppost.setHeader("Cookie", cookies.toString()); file = new File("C:\\Documents and Settings\\dinesh\\Desktop\\ImageShackUploaderPlugin.java"); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); ContentBody cbFile = new FileBody(file); mpEntity.addPart("Filename", new StringBody(file.getName())); mpEntity.addPart("action", new StringBody("upload")); mpEntity.addPart("upload_to", new StringBody("")); mpEntity.addPart("overwrite_option", new StringBody("overwrite")); mpEntity.addPart("thumbnail_size", new StringBody("small")); mpEntity.addPart("create_img_tags", new StringBody("1")); mpEntity.addPart("file0", cbFile); httppost.setEntity(mpEntity); System.out.println("executing request " + httppost.getRequestLine()); System.out.println("Now uploading your file into fileden"); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); System.out.println(response.getStatusLine()); if (resEntity != null) { uploadresponse = EntityUtils.toString(resEntity); } System.out.println(uploadresponse); downloadlink = parseResponse(uploadresponse, "'link':'", "'"); System.out.println("Download link : " + downloadlink); httpclient.getConnectionManager().shutdown(); }
Example #24
Source File: MultiUploadUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private static void fileUpload() throws IOException { DefaultHttpClient httpclient = new DefaultHttpClient(); System.out.println(postURL); System.out.println(ucookie); System.out.println(uid); HttpPost httppost = new HttpPost(postURL); httppost.setHeader("Cookie", ucookie); MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); File f = new File("h:/Rock Lee.jpg"); reqEntity.addPart("UPLOAD_IDENTIFIER", new StringBody(uid)); reqEntity.addPart("u", new StringBody(ucookie)); FileBody bin = new FileBody(f); reqEntity.addPart("file_0", bin); reqEntity.addPart("service_1", new StringBody("1")); reqEntity.addPart("service_16", new StringBody("1")); reqEntity.addPart("service_7", new StringBody("1")); reqEntity.addPart("service_17", new StringBody("1")); reqEntity.addPart("service_9", new StringBody("1")); reqEntity.addPart("service_10", new StringBody("1")); reqEntity.addPart("remember_1", new StringBody("1")); reqEntity.addPart("remember_16", new StringBody("1")); reqEntity.addPart("remember_7", new StringBody("1")); reqEntity.addPart("remember_17", new StringBody("1")); reqEntity.addPart("remember_9", new StringBody("1")); reqEntity.addPart("remember_10", new StringBody("1")); httppost.setEntity(reqEntity); System.out.println("Now uploading your file into multiupload.com. Please wait......................"); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { uploadresponse = EntityUtils.toString(resEntity); System.out.println("Response :\n" + uploadresponse); uploadresponse = parseResponse(uploadresponse, "\"downloadid\":\"", "\""); downloadlink = "http://www.multiupload.com/" + uploadresponse; System.out.println("Download link : " + downloadlink); } }
Example #25
Source File: Badongo.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void fileUpload() throws Exception { HttpClient httpclient = new DefaultHttpClient(); if (badongoAccount.loginsuccessful) { postURL = "http://upload.badongo.com/mpu_upload.php"; } HttpPost httppost = new HttpPost(postURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("Filename", new StringBody(file.getName())); if (badongoAccount.loginsuccessful) { mpEntity.addPart("PHPSESSID", new StringBody(dataid)); } mpEntity.addPart("Filedata", createMonitoredFileBody()); httppost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httppost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into badongo.com"); uploading(); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); // uploadresponse = response.getLastHeader("Location").getValue(); //NULogger.getLogger().log(Level.INFO, "Upload response : {0}", uploadresponse); NULogger.getLogger().info(response.getStatusLine().toString()); if (resEntity != null) { uploadresponse = EntityUtils.toString(resEntity); } // if (resEntity != null) { // resEntity.consumeContent(); // } NULogger.getLogger().log(Level.INFO, "res {0}", uploadresponse); httpclient.getConnectionManager().shutdown(); }
Example #26
Source File: FileSonicUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
public void fileUpload() throws Exception { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); file = new File("/home/vigneshwaran/VIGNESH/dinesh.txt"); HttpPost httppost = new HttpPost(postURL); httppost.setHeader("Cookie", langcookie + ";" + sessioncookie + ";" + mailcookie + ";" + namecookie + ";" + rolecookie + ";" + msgreadcookie + ";" + msgcheckcookie + ";"); MultipartEntity mpEntity = new MultipartEntity(); ContentBody cbFile = new FileBody(file); mpEntity.addPart("files[]", cbFile); httppost.setEntity(mpEntity); System.out.println("Now uploading your file into filesonic..........................."); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); System.out.println(response.getStatusLine()); // if (resEntity != null) { // // String tmp = EntityUtils.toString(resEntity); //// System.out.println("response : " + tmp); // // } uploadresponse = response.getLastHeader("Location").getValue(); System.out.println("Upload response URL : " + uploadresponse); uploadresponse = getData(uploadresponse); if (uploadresponse.contains("File was successfully uploaded")) { System.out.println("File was successfully uploaded :)"); } else { throw new Exception("There might be a problem with your internet connecivity or server error. Please try after some time. :("); } }
Example #27
Source File: LocalhostrUploaderPlugin.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
public static void fileUpload() throws IOException { File file = new File("/home/vigneshwaran/VIGNESH/nu-test5.txt"); DefaultHttpClient httpclient = new DefaultHttpClient(); UsernamePasswordCredentials upc = new UsernamePasswordCredentials("[email protected]", ""); HttpPost httppost = new HttpPost("http://api.localhostr.com/file"); try { httppost.addHeader(new BasicScheme().authenticate(upc, httppost)); } catch (AuthenticationException ex) { Logger.getLogger(LocalhostrUploaderPlugin.class.getName()).log(Level.SEVERE, null, ex); } MultipartEntity mpEntity = new MultipartEntity(); ContentBody cbFile = new FileBody(file); mpEntity.addPart("name", new StringBody(file.getName())); mpEntity.addPart("file", cbFile); httppost.setEntity(mpEntity); System.out.println("Now uploading your file into localhost..........................."); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); System.out.println(response.getStatusLine()); if (resEntity != null) { String tmp = EntityUtils.toString(resEntity); System.out.println(tmp); downloadlink = tmp.substring(tmp.indexOf("http:")); downloadlink = downloadlink.substring(0, downloadlink.indexOf("\"")); System.out.println("download link : " + downloadlink); } // uploadresponse = response.getLastHeader("Location").getValue(); // System.out.println("Upload response : " + uploadresponse); }
Example #28
Source File: FourUpFiles.java From neembuu-uploader with GNU General Public License v3.0 | 4 votes |
@Override public void run() { try { if (fourUpFilesAccount.loginsuccessful) { userType = "reg"; httpContext = fourUpFilesAccount.getHttpContext(); maxFileSizeLimit = 2147483648L; // 2 GB } else { userType = "anon"; cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); maxFileSizeLimit = 2147483648L; // 2 GB } if (file.length() > maxFileSizeLimit) { throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host); } uploadInitialising(); initialize(); long uploadID; Random random = new Random(); uploadID = Math.round(random.nextFloat() * Math.pow(10,12)); uploadid_s = String.valueOf(uploadID); uploadURL += uploadid_s + "&js_on=1&utype=" + userType + "&upload_type=file"; // http://de.4upfiles.com/cgi-bin/upload.cgi?upload_id=024416275372&js_on=1&utype=reg&upload_type=file httpPost = new NUHttpPost(uploadURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("upload_type", new StringBody("file")); mpEntity.addPart("sess_id", new StringBody(sessionID)); mpEntity.addPart("srv_tmp_url", new StringBody(srv_tmp_url)); mpEntity.addPart("file_0", createMonitoredFileBody()); mpEntity.addPart("file_0_descr", new StringBody("Uploaded via Neembuu Uploader!")); mpEntity.addPart("file_0_public", new StringBody("1")); mpEntity.addPart("link_rcpt", new StringBody("")); mpEntity.addPart("link_pass", new StringBody("")); mpEntity.addPart("to_folder", new StringBody("")); mpEntity.addPart("submit_btn", new StringBody("")); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into 4upFiles.com"); uploading(); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); doc = Jsoup.parse(responseString); //Read the links gettingLink(); upload_fn = doc.select("textarea[name=fn]").val(); if (upload_fn != null) { httpPost = new NUHttpPost("http://4upfiles.com/"); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("fn", upload_fn)); formparams.add(new BasicNameValuePair("op", "upload_result")); formparams.add(new BasicNameValuePair("st", "OK")); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); doc = Jsoup.parse(responseString); downloadlink = doc.select("textarea").first().val(); deletelink = doc.select("textarea").eq(3).val(); NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); downURL = downloadlink; delURL = deletelink; uploadFinished(); } } catch(NUException ex){ ex.printError(); uploadInvalid(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e); uploadFailed(); } }
Example #29
Source File: VideoWood.java From neembuu-uploader with GNU General Public License v3.0 | 4 votes |
@Override public void run() { try { if (videoWoodAccount.loginsuccessful) { httpContext = videoWoodAccount.getHttpContext(); maxFileSizeLimit = 5368709120L; // 5 GB } else { cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); maxFileSizeLimit = 5368709120L; // 5 GB } addExtensions(); //Check extension if(!FileUtils.checkFileExtension(allowedVideoExtensions, file)){ throw new NUFileExtensionException(file.getName(), host); } if (file.length() > maxFileSizeLimit) { throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host); } uploadInitialising(); initialize(); // http://upl.videowood.tv/ uploadURL = StringUtils.stringBetweenTwoStrings(responseString, "url : '", "'"); httpPost = new NUHttpPost(uploadURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("name", new StringBody(file.getName())); mpEntity.addPart("upload_id", new StringBody(uploadid_s)); mpEntity.addPart("file", createMonitoredFileBody()); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into VideoWood.tv"); uploading(); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); //Read the links gettingLink(); // http://videowood.tv/poll-upload/<upload_id> uploadURL = "http://videowood.tv/poll-upload/" + uploadid_s; responseString = NUHttpClientUtils.getData(uploadURL, httpContext); responseString = responseString.replaceAll("\\\\", ""); downloadlink = StringUtils.stringBetweenTwoStrings(responseString, "\"page_url\":\"", "\""); deletelink = UploadStatus.NA.getLocaleSpecificString(); NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); downURL = downloadlink; delURL = deletelink; uploadFinished(); } catch(NUException ex){ ex.printError(); uploadInvalid(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e); uploadFailed(); } }
Example #30
Source File: BdUpload.java From neembuu-uploader with GNU General Public License v3.0 | 4 votes |
@Override public void run() { try { if (bdUploadAccount.loginsuccessful) { userType = "reg"; httpContext = bdUploadAccount.getHttpContext(); maxFileSizeLimit = 1073741824L; // 1 GB } else { userType = "anon"; cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); maxFileSizeLimit = 52428800; // 50 MB } if (file.length() > maxFileSizeLimit) { throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host); } uploadInitialising(); initialize(); long uploadID; Random random = new Random(); uploadID = Math.round(random.nextFloat() * Math.pow(10,12)); uploadid_s = String.valueOf(uploadID); uploadURL += uploadid_s + "&js_on=1&utype=" + userType + "&upload_type=file"; // http://server4.indifiles.com/cgi-bin/upload.cgi?upload_id=196841065298&js_on=1&utype=anon&upload_type=file httpPost = new NUHttpPost(uploadURL); MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); mpEntity.addPart("upload_type", new StringBody("file")); mpEntity.addPart("sess_id", new StringBody(sessionID)); mpEntity.addPart("srv_tmp_url", new StringBody(srv_tmp_url)); mpEntity.addPart("file_0", createMonitoredFileBody()); mpEntity.addPart("file_0_descr", new StringBody("Uploaded via Neembuu Uploader!")); mpEntity.addPart("submit_btn", new StringBody("Start Upload")); httpPost.setEntity(mpEntity); NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine()); NULogger.getLogger().info("Now uploading your file into BdUpload.net"); uploading(); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); doc = Jsoup.parse(responseString); //Read the links gettingLink(); upload_fn = doc.select("textarea[name=fn]").val(); if (upload_fn != null) { httpPost = new NUHttpPost("http://bdupload.net/"); List<NameValuePair> formparams = new ArrayList<NameValuePair>(); formparams.add(new BasicNameValuePair("fn", upload_fn)); formparams.add(new BasicNameValuePair("op", "upload_result")); formparams.add(new BasicNameValuePair("st", "OK")); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); httpPost.setEntity(entity); httpResponse = httpclient.execute(httpPost, httpContext); responseString = EntityUtils.toString(httpResponse.getEntity()); doc = Jsoup.parse(responseString); downloadlink = doc.select("textarea").first().val(); deletelink = doc.select("textarea").eq(3).val(); NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink); NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink); downURL = downloadlink; delURL = deletelink; uploadFinished(); } } catch(NUException ex){ ex.printError(); uploadInvalid(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e); uploadFailed(); } }