tim jones

Greenhorn
+ Follow
since Feb 09, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tim jones

Hello Paul,

Well this is the scenario, the user needs to upload a file. In an earlier page, the file path is already collected.
Now before uploading to server, if the given filepath is valid, upload should happen or else browse option needs to be enabled for the user
to upload another file.

I did not know about JSP restrictions to access file systems. Seems quite logical now. Thanks to Tim to point that one out.
That was why I was trying to check if file is valid by creating a File object out of the filepath and validating it (either using exists() or isFile()).

Please help with your suggestions.

10 years ago
This is my requirement:
I need to allow browsing a file only if no file exists at a given location.
Any ideas on how I can go about it?
10 years ago
How would I upload a file from client side to server then?
10 years ago
Hello,

This code is present in a jsp file. The Weblogic is running on Sun Solaris system.
I open the web application from a Windows system and thus the Windows File path.

I need to confirm whether a File exists at a given FilePath in windows.
So I use the Windows File Path, try creating a File object, if file exists at the FilePath then file1.isFile() should return true.
Hope this provides more clarity.
10 years ago
Hello everybody,

I have tried to create a java File object for an existing file in Windows system. The JVM is running on a Sun Solaris application.
I am unable to get a File object using the below code:

where filenameUpd1 is a path like 'D:\tmp\test'.

I assumed the File object was not creating because of the backslash present and used the below code
to remove them:


I now get a string like ''D:\\tmp\\test' but still the file1.isFile() keeps returning false.

I tried and it returns a string '/'.

Anyway I could resolve the issue, so as to get a 'true' value from file1.isFile()? Or maybe I have done
something wrong. Kindly provide your help.
10 years ago
Thanks for the help...but the problem is not with the file-copying code that I had written...it was in fact in the client program above where it doesn't read a string value "Authenticated" sent by server side. When I corrected that error the file being sent is fine.
15 years ago
Jim, if I had any character encoding problems then the file transfer code should have failed when i run it independently but that's not the case here. When I run a program having only the file transfer part of my program then the file received is the exact one I send.
I also tried using simple input and output streams...when there was no change in output...I reverted back to previous code(using readers and writers),that too after checking if it works.
I would gladly appreciate any other critical analysis.
15 years ago
I understand it's completely unreasonable to expect someone to go through this huge amount of code and point out mistakes or give out suggestions.But since I have drained out my possible ways in the past week..i'm now turning to javaranch members as a last resort to solve this. (Iam not posting the entire code since that is too big.)

All the handshake process is going fine...but when it comes to file transfer part there's some problem. I even tried flushing the streams before sending out the file..even that did not help.Both the server-side and client-side code are executed as a thread.
15 years ago
And this is the server side working of the peer :
15 years ago
Jim,I tried what you suggested...and yes using the println was a mistake and when i used simple Input and Output Streams,the file was being transferred but still I have on junk at the receiver side.The file that I sent was of 5 KB but I received 6KB (earlier it was 17KB for 5KB).
I even executed the file transfer part of the code independently to check if it works and I found that when the code run independently the file is being sent perfectly but when I include the same in my program..I'm not getting the correct size.
I am including here my server-side and client-side of the code...See if you can give me suggestions or point out mistakes if any..

15 years ago
Here's what i did...

At the sender side :



At the receiver side:

15 years ago
Iam using sockets to transfer a file from one system to another...The file is being sent correctly but at the receiving end the file being received is of larger size than the one i'm sending...why is this happening and what can i do to rectify this error???
15 years ago
Thank you Davis Swan
I had done the same thing....used a class with only static variables and synchronized methods to act a central data resource for all the threads.But initially i couldn't use that because i had a very long loop running,so i cut down the loop to a sufficiently small one which now works fine.
Thanks for the help.
Thank you Lamont Gilbert...My requirement may not be satisfied with a wait and notify call since the threads are running normally and perform some other work if and only if a value is passed to it(It need not wait to receive that value).Can you all suggest some other way?
Just adding one more bit.I want the value to be sent between all the child threads that the main thread has created and not the child thread and main thread.i.e. One child thread has a value which should be sent to all the other child threads.