Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Hi
Friends, I just inform to you that, the following article is published by mukul's, but even though i
want to publish this article for my friends and dearest one's.
Through my OAF page i want to upload the file from local to server.
a. MessageFileUpload Bean
b. Submit Button.
Step 2: Now write the below logic in the controller class
String filePath =
pageContext.getProfile("FILE_UPLOAD_PATH");
try
DataObject fileUploadData =
pageContext.getNamedDataObject("FileUploading"); //FileUploading is my
MessageFileUpload Bean Id
if(fileUploadData!=null)
{
String uFileName =
(String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME"); // include this
line
String contentType = (String)
fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE"); // For Mime Type
BlobDomain uploadedByteStream =
(BlobDomain)fileUploadData.selectValue(null, uFileName);
System.out.println("uploadedByteStream----
>"+uploadedByteStream);
// File file = new
File("/export_home_dev/user/oracle", uFileName); //once you deploy the page
uncomment this line and give your server path according to your fish
File file = new File("D:\\santhosh", uFileName); //
comment this line once you deploy the page into server
System.out.println("File output---->"+file);
// output = new
FileOutputStream("D:\\Kumar"+uFileName);
System.out.println("output----->"+output);
input = uploadedByteStream.getInputStream();
System.out.println("input---->"+input);
byte abyte0[] = new byte[0x19000];
int i;
//
output.write(uploadedByteStream.getBytes(0,(int)uploadedByteStream.getLength(
)));
output.close();
input.close();
// fileUrl = (String)file;
}
}
catch(Exception ex)
{
throw new OAException(ex.getMessage(),
OAException.ERROR);
}
Step 4: Now Run the page and see the output.
Step 5: Before going to see the output, i will show you, in my local mahcine i don't have file
called
"BT_GEOCode_Order_To_Cash.xls" file
Step 7: Now check the Browsed file called "BT_GEOCode_Order_To_Cash.xls" file in the local
machine
Note: This application is working in local machine only , because i gave my local path for the
saving purpose, so if you want to save the file from local to server, then you need to do the
following things