Tomahawk File Upload on Remote Server

Hello,

I am building an application using tomahawk .... I am using the fileupload component to upload files onto a remote server from the user's local machine .... as described at

http://www.onjava.com/pub/a/onjava/2005/07/13/jsfupload.html?page=1

Here's my code :

In my jsf page :

<h:form enctype="multipart/form-data">

<t:inputFileUpload storage="file" value="#{uploadBean.file}"/>

<h:commandButton value="Submit" action="#{upload.importQuestionnaireFromXMLFile}"/>

</h:form>

The method associated to my upload bean is as follows:

publicvoid importQuestionnaireFromXMLFile()throws FileNotFoundException, IOException{

log.debug("enter_importQuestionnaireFromXMLFile() from Upload Bean");

this.upload();

String path=this.uploadFile.getName();

log.debug("Uploaded File Name =#0", path);

QuestionnaireImportBean.setFilePath(path);

}

The QuestionnaireImportBean is supposed to do some work with the uploaded file .....

My problem is that though the file has been successfully uploaded, it tries retrieve the file on the path as defined on the local machine instead of retrieving it from the directory on the remote machine specified in the tomahawk configs ...

Can anyone suggest whats wrong with my approach ,

Cheers,

Yogesh

[1721 byte] By [Yogesh_Jankeea] at [2007-11-26 15:01:24]
# 1
What do you mean by "upload on remote server" and what remote machine you've specified in tomahawk configs?
amitteva at 2007-7-8 8:50:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Ok I fixed it myself .....

It seems that although the file is uploaded on the path specified in tomahawk configs, you cannot access this as the file name cannot be retrieved !!

When you do

uploadedFile.getName()

it returns the path of the file on the local machine and not on the one hosting the application server

The solution to this problem is to use the input stream of the uploaded file and re write the file again !! I guess it is meant for those not using disk storage for files !!

Yogesh_Jankeea at 2007-7-8 8:50:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hi Yogesh,

I am facing sort of a similar problem with file name.Actually file name gets changed to lower case on upload and i have no way get back the original name.

One work around could be storing original name i n maybe a property file but not always a feasible way out.

Please let me know in case there was some way to retrieve the original name.

Regards

Raju

Message was edited by:

rkampli

rkamplia at 2007-7-8 8:50:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...