I am developing my personal website in Geocities. I need to upload dynamic page. I think Some XML coding need to upload jsp page. Please inform me, Anyone know about xml configuration....
Mymail id-g_jeyaraman@yahoo.co.in.
I am waiting for your reply..
How to upload the jsp page into Geocities?know about that, mail me. "g_jeyaraman@yahoo.co.in"?
Hi jeya,
Here is the XML script below. i think it will be usefull to You...
%26lt;?xml version="1.0"?%26gt;
%26lt;!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobil...
%26lt;%@ page import="org.apache.commons.fileupload.*, org.apache.commons.fileupload.servlet.Se... org.apache.commons.fileupload.disk.DiskF... org.apache.commons.io.FilenameUtils, java.util.*, java.io.File, java.lang.Exception" %%26gt;
%26lt;% response.setContentType("application/vnd... %%26gt;
%26lt;html xmlns="http://www.w3.org/1999/xhtml"%26gt;
%26lt;head%26gt;
%26lt;title%26gt;File Upload Example%26lt;/title%26gt;
%26lt;/head%26gt;
%26lt;body%26gt;
%26lt;h1%26gt;Data Received at the Server%26lt;/h1%26gt;
%26lt;hr/%26gt;
%26lt;p%26gt;
%26lt;%
if (ServletFileUpload.isMultipartContent(re...
ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
List fileItemsList = servletFileUpload.parseRequest(request);
String optionalFileName = "";
FileItem fileItem = null;
Iterator it = fileItemsList.iterator();
while (it.hasNext()){
FileItem fileItemTemp = (FileItem)it.next();
if (fileItemTemp.isFormField()){
%%26gt;
%26lt;b%26gt;Name-value Pair Info:%26lt;/b%26gt;%26lt;br/%26gt;
Field name: %26lt;%= fileItemTemp.getFieldName() %%26gt;%26lt;br/%26gt;
Field value: %26lt;%= fileItemTemp.getString() %%26gt;%26lt;br/%26gt;%26lt;br/%26gt;
%26lt;%
if (fileItemTemp.getFieldName().equals("fil...
optionalFileName = fileItemTemp.getString();
}
else
fileItem = fileItemTemp;
}
if (fileItem!=null){
String fileName = fileItem.getName();
%%26gt;
%26lt;b%26gt;Uploaded File Info:%26lt;/b%26gt;%26lt;br/%26gt;
Content type: %26lt;%= fileItem.getContentType() %%26gt;%26lt;br/%26gt;
Field name: %26lt;%= fileItem.getFieldName() %%26gt;%26lt;br/%26gt;
File name: %26lt;%= fileName %%26gt;%26lt;br/%26gt;
File size: %26lt;%= fileItem.getSize() %%26gt;%26lt;br/%26gt;%26lt;br/%26gt;
%26lt;%
/* Save the uploaded file if its size is greater than 0. */
if (fileItem.getSize() %26gt; 0){
if (optionalFileName.trim().equals(""))
fileName = FilenameUtils.getName(fileName);
else
fileName = optionalFileName;
String dirName = "/file_uploads/";
File saveTo = new File(dirName + fileName);
try {
fileItem.write(saveTo);
%%26gt;
%26lt;b%26gt;The uploaded file has been saved successfully.%26lt;/b%26gt;
%26lt;%
}
catch (Exception e){
%%26gt;
%26lt;b%26gt;An error occurred when we tried to save the uploaded file.%26lt;/b%26gt;
%26lt;%
}
}
}
}
%%26gt;
%26lt;/p%26gt;
%26lt;/body%26gt;
%26lt;/html%26gt;
Byeeeeeee
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment