Perl question - Saving files from my page
Results 1 to 7 of 7

Thread: Perl question - Saving files from my page

  1. #1
    Junior Member
    Join Date
    Jul 2002
    Posts
    29

    Perl question - Saving files from my page

    This is what I want to do... I want to allow someone to save a file (in my case an image) from my webpage... They are stored in a directory (http://www.mysite.com/mypictures/)... Is it possible with a perl script to save pic1.jpg in the mypictures directory to a local hard drive? If so how would I go about doing it?

    Thanks!

  2. #2
    Junior Member
    Join Date
    Jul 2002
    Posts
    29
    I have figured out how to connect to the website, now I just dont know how to download the file... Any suggestions would be GREAT! Thanks!

  3. #3
    Senior Member roswell1329's Avatar
    Join Date
    Jan 2002
    Posts
    670
    I'm afraid I'm going to need a bit more clarification. You have a website, and you want to write a perl script to save the images from your website to your harddrive. Any reason you can't just use right-click on the mouse?

    Or are you trying to create a webpage that pulls images off another website? Like a webpage that pulls comics off of various pages? I have several of those.

    Just a little clarification, please!
    /* You are not expected to understand this. */

  4. #4
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    Forgive me if I understand you incorrectly... You want to have a script save files *from* your web site *to* a machine's local drive?

    I'm afraid this cannot be done. For obvious security reasons, web browsers strictly forbid this kind of thing. Perl CGI scripts (like any other CGI programs) run on the server-side, and hence are not able to access the local drives of machines.

    Javascript and other client-side stuff runs locally but has very strict rules about what it's not allowed to do. Saving files locally is one of them.

    Of course if you want to run a stand-alone perl program, that could load an image from the web and save it locally very easily, however:

    1. They would need to have perl installed for it to work and
    2. They would need the same level of trust to trust a perl script running locally as an .exe that you had created, so most people are not going to want to run the script (even if they are able to)

  5. #5
    Junior Member
    Join Date
    Jul 2002
    Posts
    29
    Basically I want to be able to save images from my website to my hard drive... I could right click on the files but that doesnt involve perl... I want to use perl to do it... It helps me understand sockets and copying files using perl... thanks!

  6. #6
    Junior Member
    Join Date
    Jul 2002
    Posts
    29
    Hmmm... I think I am confused...

    Is it possible to run a perl script from my local machine that will download the file http://www.weburl.com/images/pic1.jpg located on another machine?

    doing the same thing as rightclicking on the image pic1.jpg and selecting save as?

    Thanks!

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,786
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •