Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Upload file on server using applet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to create an applet for my asp.net web application.I have to make drag and drop functionality in applet.
I have created an applet where i make a functionality for email drag and drop from outlook and store that email on client machine. Its working fine but after creating a file i have to upload those file on my server.
I can not use servlet because my application is developed in asp.net mvc.


Can anyone help me how to upload file on server using applet and ASP.NET.

Below is my code for creating file on client machine


String libFile = System.getProperty("os.arch").equals("amd64") ? "jacob-1.18-M2-x64.dll" : "jacob-1.18-M2-x86.dll";
InputStream inputStream = new FileInputStream("C:\\OutlookConfig\\"+libFile);

File temporaryDll = File.createTempFile("jacob", ".dll");
FileOutputStream outputStream = new FileOutputStream(temporaryDll);
byte[] array = new byte[8192];
for (int i = inputStream.read(array); i != -1; i = inputStream.read(array)) {
outputStream.write(array, 0, i);
}
outputStream.close();

System.setProperty(LibraryLoader.JACOB_DLL_PATH, temporaryDll.getAbsolutePath());
LibraryLoader.loadJacobLibrary();

txtArea.append("Creating message files....");

ActiveXComponent xl = new ActiveXComponent("Outlook.Application");
Dispatch explorer = Dispatch.get(xl,"ActiveExplorer").toDispatch();
Dispatch selection = Dispatch.get(explorer, "Selection").toDispatch();
Variant count = Dispatch.get(selection, "Count");

// loop over selected mail items.
for (int mailIndex = 1; mailIndex <= count.getInt(); mailIndex++ ) {
Integer[] k = new Integer[]{new Integer(mailIndex)};
Dispatch mailItem = Dispatch.call(selection, "Item", k).toDispatch();
// Variant subject = Dispatch.get(mailItem, "Subject");
String fileid = UUID.randomUUID().toString();
String[] save = new String[]{"C:\\OutlookConfig\\"+fileid+".msg"};

Variant saved = Dispatch.call(mailItem, "SaveAs",save);



}


Thanks
 
I can't take it! You are too smart for me! Here is the tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic