Hello all,
I'm using a FileUpload component and can't figure why I'm having this problem.
I have a button on the iView that calls this method when clicked.
<code>
public void onUpload(Event event)throws PageException{
__FileUpload fu = (FileUpload)this.getComponentByName("myFileUpload");
__if(fu!=null){
____IFileParam fileParam = fu.getFile();
____if(fileParam!=null){
______File f = fileParam.getFile();
______if(f!=null){
________uploadResource(f);
______}else
________myDDM.setStatus("Could not create File object");
____}else
______myDDM.setStatus("Could not create IFileParam object");
__}else
____myDDM.setStatus("Could not create FileUpload object");
}// End Method onUpload
</code>
I click said button after first 'Browsing' with the FileUpload component and selecting a file. When I check the status that has been set it is "Could not create IFileParam object" every time, which means that
<code>
IFileParam fileParam = fu.getFile();
</code>
returns NULL every time. Why would it do this after I've selected a file using the 'Browse' button of the FileUpload component.
Any ideas? The Javadoc for FileUpload is somewhat lacking. I see that there is a setAccept method which receives a String for mime type; but the API says that it isn't required.
I previously had this working as a JSPDynPage but strangely each time I previewed after deploying the .par file I got the old familiar "Dispatcher running, but no server connected" message. I'd wait 10 minutes, the server would be back up, I'd preview again and it would work. Strange. Now I'm using a DynPage and just coding the UI in Java, deploying doesn't knock the server over anymore but neither will it upload files.
As always, your help is well appreciated.
Patrick.
Add a comment