January 12th, 2003, 08:55 PM
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?
January 12th, 2003, 10:53 PM
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!
January 12th, 2003, 11:23 PM
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. */
January 12th, 2003, 11:43 PM
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.
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)
January 12th, 2003, 11:46 PM
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!
January 13th, 2003, 01:05 AM
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?
January 13th, 2003, 02:27 AM
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.’”