473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

How to read the file from client machine

madhoriya22
252 100+
Hi,
I am using jsp and servlets in my application. In this application I am reading contents of *.csv files and uploading them to database.
Now this thing is working fine when I am running my application on single machine(sever and client). But when I am running my application on other machines(client) I am not able to read the files(*.csv). It is throwing FileNotFoundException.
How should I read the file from client machine. Can MIME be helpful in this regard.
Sep 10 '07 #1
9 6381
r035198x
13,262 8TB
Hi,
I am using jsp and servlets in my application. In this application I am reading contents of *.csv files and uploading them to database.
Now this thing is working fine when I am running my application on single machine(sever and client). But when I am running my application on other machines(client) I am not able to read the files(*.csv). It is throwing FileNotFoundException.
How should I read the file from client machine. Can MIME be helpful in this regard.
How are you specifying the path then?
Sep 10 '07 #2
madhoriya22
252 100+
How are you specifying the path then?
Hi,
Right now in my jsp page I have put this ..
Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="file" name="CSVFilePath" />
  3.  
I am getting the path from this file select option ..
Expand|Select|Wrap|Line Numbers
  1.  
  2. String path = request.getParameter("CSVFilePath");
  3.  
and passing it to the function...
Expand|Select|Wrap|Line Numbers
  1.  
  2. boolean b = defectDetailDAO.uploadCSVfileIntoDataTable(filePath)
  3.  
But doing same thing from client machine it is throwing FileNotFoundException.
Sep 10 '07 #3
Nepomuk
3,112 Expert 2GB
Hi,
Right now in my jsp page I have put this ..
Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="file" name="CSVFilePath" />
  3.  
I am getting the path from this file select option ..
Expand|Select|Wrap|Line Numbers
  1.  
  2. String path = request.getParameter("CSVFilePath");
  3.  
and passing it to the function...
Expand|Select|Wrap|Line Numbers
  1.  
  2. boolean b = defectDetailDAO.uploadCSVfileIntoDataTable(filePath)
  3.  
But doing same thing from client machine it is throwing FileNotFoundException.
Is that CSV file on the client or the server? Cause, if it's on the client, that's probably the problem, as JSP is server based and will therefore look for the file on the server.

Greetings,
Nepomuk
Sep 10 '07 #4
madhoriya22
252 100+
Is that CSV file on the client or the server? Cause, if it's on the client, that's probably the problem, as JSP is server based and will therefore look for the file on the server.

Greetings,
Nepomuk
Hi,
CSV file I am selecting from the client machine .
Sep 10 '07 #5
Nepomuk
3,112 Expert 2GB
Hi,
CSV file I am selecting from the client machine .
In that case I guess you'll have to upload it to the server first. The server probably won't be able to find it, because it's searching for a local file, while the file you want isn't local.

Greetings,
Nepomuk
Sep 10 '07 #6
madhoriya22
252 100+
In that case I guess you'll have to upload it to the server first. The server probably won't be able to find it, because it's searching for a local file, while the file you want isn't local.

Greetings,
Nepomuk
Hi,
Any Idea how to do that ? Just starting point :)
Sep 10 '07 #7
Nepomuk
3,112 Expert 2GB
Hi,
Any Idea how to do that ? Just starting point :)
I don't think it's a good idea (if possible) to upload it with Java, but there are alternatives... By searching the forum, I found this. ^^

Greetings,
Nepomuk
Sep 10 '07 #8
madhoriya22
252 100+
I don't think it's a good idea (if possible) to upload it with Java, but there are alternatives... By searching the forum, I found this. ^^

Greetings,
Nepomuk
Hi,
I am not using JavaScript/Ajax. I have to done it in java.
Any help :(
Sep 10 '07 #9
Nepomuk
3,112 Expert 2GB
Hi,
I am not using JavaScript/Ajax. I have to done it in java.
Any help :(
Can't you just have a little bit of JavaScript/Ajax for that task in the page, which also loads the JSP? Otherwise I guess you have a problem, as the only way with Java I can think of is by having the user install a piece of software on the client. THEN you could work with sockets. However, very few people would want to do that.

Greetings,
Nepomuk
Sep 10 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Zed | last post by:
I have a problem with .net writing to a remote server that I need to deploy on. The app works fine on my local machine. But when got access to the server I went to VS.NET and tried to create a...
0
by: Hai Ly Hoang \(MT00KSTN\) | last post by:
Hi, FileStream.Read(buf, offset, siz) will return when reaching the end of file or a block (size siz) can be read from the file. In the case of NetworkStream, it's more confusing. Now, consider...
1
by: POnfri | last post by:
Hi, I have a problem in a peace of code were i'm doing a file copy using File.Copy. The Source is local and the target is a remote machine. Example: File.Copy(C:\temp\hi.txt,...
2
by: ying | last post by:
I need develop an asp.net script which will run on web server. The script need read documents from client's machine(know the filename, need check if the file exist or not), convert the file to...
4
by: Michael | last post by:
I am trying to open a file on the client machine from an aspx page running server side. The design requirements of the page specify that the HtmlInputFile control is not to be used. Since the...
6
by: dinoo | last post by:
Hi, I would appreciate if some one could help me out. I have to read a client side ini file in Aspx page and use that data in server side processing. Can any one help me out here? Please refer...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
8
by: Johnny | last post by:
Hi all: I have an ASP.NET form that reads an Excel file and populates a datagrid. If I load the form in IE on the server, and select a local file, the code works fine. However if I load the form...
4
by: Ross | last post by:
Hello, I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition. So far I have managed to complete my testing with a local text file using...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.