Thursday, March 10, 2011

Invoking Download in Javascript

<html>
     <head>
    </head>
<body>
   <table border='0'>
       <tr>
                <td><font onclick="startDownload ()">Download</font></td>
      </tr>
  </table>
</body>
    <script type="text/javascript" language="javascript">
      function startDownload ()
      {
              var windowStyle = "height=500, width=500, left=5, top=5, status=no, toolbar=no, " +
               "menubar=no, location=no, resizable=no, scrollbars=no";
 
              var url='<File Path>';  
              window.open(url,'Download', windowStyle );
     }
    </script>
</html>

Wednesday, March 9, 2011

Moving files from one Folder to other using java

import java.lang.*
import java.io.*
public class MoveFile
{
         //File or Directory to be moved
         File file = new File ();
         // Destination directory
         File dir = new File ();
         boolean Success = file.renameTo (new File (dir, file.getName ()) );
         if (Success)
           System.out.println ("File Moved");
}