• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

Reading/writing files

Is it possible to open a file from the net..and then write the data from that file to the users local drive?

If it is possible, could someone please provide me with some code to do it.

Thanks
0
wormboy__6
Asked:
wormboy__6
  • 4
  • 3
  • 2
1 Solution
 
ozoCommented:
#!/usr/bin/perl
use LWP::Simple;
$rc = getstore("http://experts-exchange.com/Q.10242772", "localfile");
print status_message($rc) if( $rc != RC_OK );
0
 
wormboy__6Author Commented:
ok, how do i make this into a workable cgi?

Do i need a certain programme or compiler?
0
 
jhurstCommented:
I am assuming that you want something on the server to do this.  If this is the case then the answer is NO, for security reasons.  You would not want a web site to be able to write to your hard drive.  However, if the web-user installs a plug-in, or application then it is possible.  

ozo is suggesting a method that will owrk if the user is to run perl on his/her local machine.  I suspect you do not want to do this.  And, this would require that the user install perl.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
wormboy__6Author Commented:
well can you call windows api functions on the client from a perl script?

0
 
ozoCommented:
If the client is the one who is running the perl script.
0
 
wormboy__6Author Commented:
im talking about running a script on the net..and people connecting to it via their browser.

So if they did this...i couldnt get the client to perform api tasks ...or could i?

the client isnt running the script...the web server is
0
 
ozoCommented:
A program running on the server cannot perform api tasks on the client,
unless the client is running a program which performs the api tasks for it.
0
 
jhurstCommented:
I think that ozo and are saying the same thing, now.  The only thing I would add to wht he is saying is that you could install a plug in or application on the client machine the first time he comments and this could do what you want.  You can not do this in a transparent manner but you can certainly send him a file of an executable type that will later be used by files of a certain type sent to it.  The user will be told that the file type in uinrecognized and asked what to do with it.  You know the type of thing: like you get when you download something from the web.
0
 
wormboy__6Author Commented:
yeh i know...how about running a method from an activex component.

eg loading the mswinsck.ocx and making it listen.

In Visual Basic i would do it like this:

Winsock1.Listen

in a cgi script..how can i load an object and performa task with it..run a method

is it possible?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now