<%@ page language="java" contentType="text/html" import="akadia.*, java.util.*, javax.mail.*, javax.mail.internet.*" errorPage="errorpage.jsp" %>
<jsp:useBean id="TheBean" scope="page" class="akadia.FileUploadBean" />
<%

// Upload directory on server
String updir = "Enter your Upload Directory here";

// File upload part (import FileUploadBean!!)
TheBean.setSavePath(updir);
TheBean.doUpload(request);  // The bean makes all for us

// Response email part
Properties props = new Properties();
props.put("mail.smtp.host", "Enter your Mail Server here");
Session s = Session.getInstance(props,null);

MimeMessage message = new MimeMessage(s);

message.setFrom(new InternetAddress("upload@akadia.com"));

InternetAddress to = new InternetAddress("Enter Mail Address here");
message.addRecipient(Message.RecipientType.TO, to);

message.setSubject("File Upload arrived!");

// Generate email body
StringBuffer text = new StringBuffer();
text.append("Dear Akadia Dev Team\n\n");
text.append("This is an automtically generated EMail from the File Upload Utility\n");
text.append("on Akadias Intranet Site.\n");
text.append("You have got the File:  " + TheBean.getFilename() + "\n");
text.append("Destination Directory on Server: "+ request.getServerName()+":"+updir);

message.setText(text.toString());

Transport.send(message);
%>

<html>
  <head>
    <link rel=stylesheet href=https://www.akadia.com/docroot/css/website.css type=text/css>
    <title>File Upload Result</title>
  </head>
  <body bgcolor="#FFFFFF" link="#000000" vlink="#000000" alink="#000000" text="#000000">
    <img src="../img/red_arrow_2.gif" WIDTH=9 HEIGHT=9>&nbsp;
    <a href=javascript:history.back()>Back</a><br><br>
    <b>File Upload complete</b><br><br>
    <b>File transfered: </b><%=TheBean.getFilename()%><br>
    <b>Content Type: </b><%=TheBean.getContentType()%><br>
    <b>Transfered to HTTP-Server: </b><%=request.getServerName()%><br>
    <b>Directory on Server: </b><%=updir%>
  </body>
</html>