on 12-12-2008 1:31 PM
Hi experts,
My Requirement is:
While clicking File UpLoad Browse button it should take me to the file loction of my desire by default.
Say: I have created a folder with the name of the user in the Server. When i access from the client machine, on click of the browse button the file upload dialog box should locate the user named folder in the server by default.
Please forward your suggestion.
Thanks,
RPN
Edited by: RPN on Dec 12, 2008 2:46 PM
RPN,
Your requirement is to upload files to a particular server directory that you have created..
IWDUpload UI element get you the Resource and while writing it to the server, specify the path to it.
String path = "D:\\Test\\";
byte[] bytes = new byte[ 1024];
FileOutputStream out = new FileOutputStream( new File( path));
InputStream in = resource.read( true);
int len;
while( ( len = in.read( bytes)) > 0)
{
out.write( bytes, 0, len);
}
in.close();
out.close();
vinod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Check this PDF link.It will help you
Regards
Ruturaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Say: I have created a folder with the name of the user in the Server. When i access from my local machine, on click of the browse button the file upload dialog box should locate the user named folder in the server by default.
I dont think this will work. especially pointing to the folder in server(How will the client browser no the shared folder of server?)
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Check this pdf for creating folder dynamically
for hardcoding see this code
public void onActionUploadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionUploadFile(ServerEvent)
String FileName = "temp";//wdContext.currentContextElement().getDirectory();
InputStream input = null;
int i=0;
FileIncreament();
try {
String directory =".
temp
webdynpro
web
local
yh1245_ftp"+
"
Components
com.yash.yh1245.Upload
"FileNamewdContext.currentContextElement().getCounter();
boolean sucsss = new File(directory).mkdir();
if(sucsss){
wdComponentAPI.getMessageManager().reportSuccess("Directory Created ");
File file = new File(directory"
"wdContext.currentContextElement().getResourceURL().getResourceName().toString());
FileOutputStream fos = new FileOutputStream(file);
wdComponentAPI.getMessageManager().reportSuccess(file.getAbsolutePath());
FilePath = file.getAbsolutePath();
if(wdContext.currentContextElement().getResourceURL()!=null){
input = wdContext.currentContextElement().getResourceURL().read(false);
//wdComponentAPI.getMessageManager().reportSuccess("Resource is not null ");
while((i = input.read())!=-1){
fos.write(i);
}
}
fos.flush();
fos.close();
wdComponentAPI.getMessageManager().reportSuccess("File Uploaded on server directory ");
//wdComponentAPI.getMessageManager().reportSuccess("Created File Locaiton::"+file.getAbsolutePath());
//}
//Get the File Size
// IPrivateFTPUpload.IContextElement element = wdContext.currentContextElement();
// if (element.getResourceURL()!=null) {
// IWDResource resource = element.getResourceURL();
// element.getFileSize(this.getFileSize(resource));
// }
}
}catch(Exception e){
e.printStackTrace();
}
//@@end
}
thanks
Hi
Pls follow this link might helps This contains the complete creating a folder and also uploading the file
Regards
Prasad.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.