on 2008 Oct 21 10:29 AM
Hi Experts,
I have a reqiurement that to upload only the jpg,pnf and gif image file. Then I have to pass the url to backend..
can anyone pls explain me with code..
regrds
Kiruba
Hi Kiruba,
go through this doc:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d0e599cc-2862-2b10-54a9-dcf1376b52d7]
it will solve ur problem.
this will upload all kinda image file on server.
If u get any problem thn lemma knw.
Regards
Khushboo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
As u already reply that, I have to creat the resource for image upload..(jpg,gif,pnf) But Wht I have done was,I have not binded the resource property.suppose when i bind that, the details of my uploaded file has not displayed. Here I have attached my code.
File ff=new File("New file");
ff.mkdir();
try {
byte[] b=null;
IWDAttributeInfo att=null;
IWDModifiableBinaryType bintype=null;
File f=null;
FileOutputStream fos=null;
IWDResource resource=wdContext.currentContextElement().getPhotores();
if(wdContext.currentContextElement().getResource()!=null){
b=wdContext.currentContextElement().getResource();
att=wdContext.getNodeInfo().getAttribute(IPrivateUploadView.IContextElement.RESOURCE);
bintype=(IWDModifiableBinaryType)att.getModifiableSimpleType();
wdContext.currentContextElement().setFileExtension(bintype.getMimeType().getFileExtension());
wdContext.currentContextElement().setFileSize(this.getFileSize(b));
wdContext.currentContextElement().setDetailsVisiblity(WDVisibility.VISIBLE);
wdComponentAPI.getMessageManager().reportMessage(IMessagePhUpload.UPLOAD,new Object[]{bintype.getFileName()},false);
f=new File(""+bintype.getFileName());
fos=new FileOutputStream(f);
fos.write(b);
fos.flush();
fos.close();
}
else{
wdContext.currentContextElement().setDetailsVisiblity(WDVisibility.NONE);
wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.currentContextElement(),wdContext.getNodeInfo().getAttribute(IPrivateUploadView.IContextElement.RESOURCE),IMessagePhUpload.NOFILE,new Object[]{""},true);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
where I have to write the code for filtering the images..(jpg,pnf,gif)
reg
kiruba
Hi,
Search in SDN there are lots of thread and documents on how to upload file and regarding your requirement that you need only .gif and .jpg files to be uploaded then you might be using the following code
IPrivateUploadView.IContextElement element1 = wdContext.currentContextElement();
IWDResource resource = element1.getResource();
if(resource.getResourceType().getFileExtension()==<<with your condition);
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Follow these links
http://www.vogella.de/articles/SAPWebDynpro/article.html
PS: if ans is helpful plz award with points
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.