cancel
Showing results for 
Search instead for 
Did you mean: 

File upload and download in server through web Dynpro

Former Member
0 Kudos

Hai all,

i want to store one document in SQL Server 2000 through Webdyn pro. I inserted

one document through java into SQL Server 2000 using the following method which name is

insertFile(...).

void insertFile(FileDBTransfer fdb, Connection cn, String FileName)throws IOException, FileNotFoundException, SQLException

{

int FileLength;

FileInputStream fis;

PreparedStatement pstmt;

int last=FileName.lastIndexOf("/");

String docname=FileName.substring(last+1,FileName.length());

fis = fdb.getFileInputStream(FileName);

FileLength= fdb.getFileLength(FileName);

pstmt = cn.prepareStatement("insert into ReportArchive values(?,?)");

pstmt.setString(1,docname);

pstmt.setBinaryStream(2, fis, FileLength); //method to insert a stream of bytes

pstmt.executeUpdate();

}// end insertZipFile

Here i have given file name like "c:\test\test.pdf" it's work fine.

My J2EE server is running different machine and my Netweaver is another machine.

If both server and IDE in same machine it's work fine. But both are in different machine,

i have some problems.

If i try like this server always go and check his own path, not client machine

so it will error like "given source not found". So if i get client machine's path

then i will store easily into SQL Server 2000.

Whenever i run, it should check the client machine path instead of server path.

Thanks in advance,

K.Saravanan.

Accepted Solutions (0)

Answers (2)

Answers (2)

kishorg
Advisor
Advisor
0 Kudos

HI Saravan,

just upload the file into a temp directory in the server and take that file from server's relative path.

for uploading files to server just refer this weblog.

/people/ruediger.bachmann/blog/2006/01/07/uploadingdownloading-files-intofrom-sap

Regards

Kishor Gopinathan

Former Member
0 Kudos

Hai kishor,

Thank you for your reply.Are you have java codings for file upload and download in server through webdynpro.How to apply servlet codings for webdynpro.

Thanks is Advance,

S.V.Selva Bala.

Former Member
0 Kudos

Hi,

Accessing a directory in the client system is possible only through the upload UI element.

The Web Dynpro application that you have created runs in your server system and hence the c: that you refers to would be that of the server instead of the client machine.

regards,

Noufal

Former Member
0 Kudos

Hai,

Thank you for your reply.

We are using UIElemetn for File upload.When selecting Browse button File path is displayed on text box.If i want to create one temporary directory on server from client and store the selected file.I am binding one binary variable with file upload.How to fetch selected file path from upload button.

Thanks in Advance,

s.v.selva bala.

kishorg
Advisor
Advisor
0 Kudos

HI Saravan ,

if u want to fetch that selected filename ,

then create one string variable in the context ,

then in the property editor ,

against the fileName attribute bind this string varibale .

this contain the file name to be uploaded.

Former Member
0 Kudos

Hai kishor,

If declare string variable in the context,finally it should give only the name of the file.I couldn't get the entire path of the file.How to fetch entire path of the file.

Thanks in advance,

S.V.Selva Bala.

kishorg
Advisor
Advisor
0 Kudos

Hi Saravan,

Data

-


Determines the data drain, that is, the location of the data, of the file to be uploaded in the context. The system can only read this data value.

fileName

-


Gives exact filename

Refer IWDFileUpload also

http://help.sap.com/saphelp_nw04/helpdata/en/5a/90ff4cd0c8cd48a69b836e5e550880/content.htm

Regards

Kisgor Gopinathan

Message was edited by: Kishor Gopinathan

Message was edited by: Kishor Gopinathan