You need to sign in to do that
Don't have an account?
Rahul456
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection>
<apex:inputFile value="{!document.body}" filename="{!document.name}"/>
<apex:commandButton value="save" action="{!save1}"/>
<apex:param name="q" value="{!document.name}"/> <!Tried using this -->
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
what syntax to use to get a file name,of which I am uploading using Input File,plz suggest ASAP
For suppose path of the file I am uplaoding is the below one:
C:\Documents and Settings\rajnoot\Desktop\login.txt
Here Name of the file is login.txt,So how to retrieve this file name,when I am uploading this file.
I used below Code:But it is not working::::
Page Editor Code:::
<apex:page StandardController="Document" extensions="documentExt">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection>
<apex:inputFile value="{!document.body}" filename="{!document.name}"/>
<apex:commandButton value="save" action="{!save1}"/>
<apex:param name="q" value="{!document.name}"/> <!Tried using this -->
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller Code:::
public class documentExt {
String path;
ApexPages.StandardController controller;
public documentExt(ApexPages.StandardController controller)
{
this.controller=controller;
Document d = (Document) controller.getRecord();
d.folderid = UserInfo.getUserId(); //this puts it in My Personal Documents
ApexPages.StandardController controller;
public documentExt(ApexPages.StandardController controller)
{
this.controller=controller;
Document d = (Document) controller.getRecord();
d.folderid = UserInfo.getUserId(); //this puts it in My Personal Documents
}
// ** Overriding the save method **
public PageReference save1()
{
controller.save();
path=System.currentPageReference().getParameters().get('q');
System.debug('Uplaoded File Name is:::'+ path); /*showing path Value as NULL*/
return page.docsample;
}
}
// ** Overriding the save method **
public PageReference save1()
{
controller.save();
path=System.currentPageReference().getParameters().get('q');
System.debug('Uplaoded File Name is:::'+ path); /*showing path Value as NULL*/
return page.docsample;
}
}
Please Suggest me,How to get file name in path variable
HTML:
<input type="file" id='FilePath' name='FilePath'>
S-CONTROL:
var filePath = document.getElementById('FilePath').value;
How do we do the same with Visualforce?
Message Edited by esa on 01-19-2009 11:11 PM