944,191 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 2942
  • JSP RSS
May 23rd, 2007
0

Finding if files exist.. file on local machine, problems on server

Expand Post »
I've been using Tomcat/local machine to produce some jsp pages for uploading files.
Files are selected and added to a listbox on a form, once the form is submitted - the filenames in the list are uploaded. Firstly there is a check to see if they exist. Something to the effect of..
JSP Syntax (Toggle Plain Text)
  1. File file = new File(filenames[x]);
  2. file.exist();
for each file.
So typically in the listbox there will be C:\readme.txt or something to that effect. On local machine, this works perfectly - files are found and uploaded. However now, since I put this online to a server (which is an oracle server) when the form is submit -- the file can not be found. Initially when submit, the \'s would be removed.. (filenames which are not found are displayed in an error message) e.g C:\log.txt becomes C:log.txt so I added code to change this to unix separators.. C:\log.txt then becomes C:/log.txt ... still it cant find the file.
My experience with unix is fairly limited, is there a certain of writing a filename like that so that the jsp can pick it up? Or perhaps something I should look into to do with server itself? Any suggestions are appreciated. Thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
uninvitedm is offline Offline
5 posts
since May 2007
May 23rd, 2007
0

Re: Finding if files exist.. file on local machine, problems on server

Do you have any idea at all what you're doing there?
Any idea in fact about what code is run where?

Because if you did (and you should if you're going to do any serverside development) you'd know why it's not working and in fact can't work.

Hint: you're trying to do something with files located on the client using code running on the server.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: Replacement of goto????
Next Thread in JSP Forum Timeline: Calling if() again in JSP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC