Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in copying file from server to client local machine folder

 
Tushar Mundada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to copy files fron the server to local machine, This code is not giving error while execution but I am not able to see file getting copied on my local machine
Probabaly file is getting copied on the server only.
Can anybody tell, how can I know where the file is getting copied & How I can copy it to a Local folder?

 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Please UseCodeTags. I've added them (and a bit of indentation) for you this time.

Aren't you a) specifying on line 13 to which file you are copying the file, and b) doing the actual copying in lines 14-20?
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code is transferring data via HTTP, something you aren't going to be able to do locally unless you are running a web server configured to receive an upload.
You probably want to do something like this or these examples.
 
Tushar Mundada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Joe
Thanks Joe for you reply

Your code is transferring data via HTTP, something you aren't going to be able to do locally unless you are running a web server configured to receive an upload.

can you elaborate it
or anybody has any other solution for this............

@Rob

yes, On line 12 I am specifying which file on the server I want to copy & below is the logic with destination folder on Local on line 13
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry. I totally read your code wrong. Your code accesses a URL and copies the resource locally. If you are having a problem, there's a couple of things that can go wrong. Does the directory c:\temp exist and do you have permission to write to it? Can you open the URL you are trying to download in a browser? Do you print out possible exceptions?
 
Tushar Mundada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

I have got permission to copy that file to folder to locam machine & Temp folder exist in the C drive.
I can open the URL in the browser.
When I run this code I dont get any exceptions (I checked printing sysouts till the end of the code, it runs without exceptions & errors) but I am not able to find out where this file is getting copied.

Thanks for your support!
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code works fine for me. I ran into a glitch in Ubuntu where the file was saved to the current working directory, but on Windows it performed as expected, downloading an image and saving it to c:\temp\testplans1.jpg
Do you have to log into a web application to view the file you are downloading?
 
Tushar Mundada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I dont have to Log on to web application to view the files I am downloading. When I run the code from eclipse on my local machine then it works fine& I can see the file created in Temp folder in C: drive but when I deploy the code on the weblogic server then I dont get the location where the file is getting stored, I doubt whether it is getting stored on server's directory
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is Weblogic running locally or on a server?
 
Tushar Mundada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
weblogic is running on server. Can we make files on local machine from the code running on server?

Below code runnning on the server. when we execute this from the client computer it doesnt give any exception or error but
it is not creating any document on local.




 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tushar Mundada wrote:weblogic is running on server. Can we make files on local machine from the code running on server?


No, unless the server has a network drive or file share to the local drive.
The more common way is to allow the user to download a file from the server rather than trying to push it.
 
Tushar Mundada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you joe
 
Tushar Mundada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I want to allow user to download all the files from server with a single button click is there any other way than making a zip file of all the files & presenting to user??
(I know the URL of the all the files I want to download & there are other files also in the same folder from which I want to download my files)
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!