| | |
Finding if files exist.. file on local machine, problems on server
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2007
Posts: 5
Reputation:
Solved Threads: 0
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..
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
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)
File file = new File(filenames[x]); file.exist();
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
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.
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.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
![]() |
Similar Threads
- File Uploads (PHP)
- save file on client machine (C#)
- Moving Files with Dreamweaver (IT Professionals' Lounge)
- How to generate pdf file automatically at background? (HTML and CSS)
- how to backup mysql DB to local machine? and restore? (MySQL)
- copying mssql database on my local machine to a mysql database online (MySQL)
- how to copy a file from one machine to another using beans? (Java)
- Please help with a script (Visual Basic 4 / 5 / 6)
Other Threads in the JSP Forum
- Previous Thread: Replacement of goto????
- Next Thread: Calling if() again in JSP
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web






