Re: Fileposting
--- Bernhard [EMAIL PROTECTED] wrote: Hi! I'm using a html form, where you can enter a file (a picture) and upload it, but when i send the form the Perl script only gets the local Adress of the file, but not the Data (so the picture) of the file. How can i save the picture in a new file on my Disk? I have programmed it so that the new file will be saved in a new Folder. If you're using CGI.pm, then I think the name you get is also the opened filehandle from which to read the content. Just open the new filename you want, read the data, write to disk. Check the CGI.pm docs. Oh, and make *sure* you use a multipart form! = print Just another Perl Hacker\n; # edited for readability =o) = Real friends are those whom, when you inconvenience them, are bothered less by it than you are. -- me. =o) = There are trivial truths and there are great Truths. The opposite of a trival truth is obviously false. The opposite of a great Truth is also true. -- Neils Bohr __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: Fileposting
On Tue, 29 May 2001, Bernhard wrote: But I'm not using CGI.pm. I don't know what i should do with it. I only want to use Perl. You should be using CGI.pm if you want to do CGI programming with Perl. I also recommend that you subscribe to the beginners CGI mailing list -- it focuses specifically on CGI programming with Perl. You can subscribe to it by going to http://learn.perl.org and selecting from the list, or by sending an email to [EMAIL PROTECTED] -- Brett Brett W. McCoy Software Engineer Broadsoft, Inc. 240-364-5225 [EMAIL PROTECTED]
Re: Fileposting
At 07:45 PM 5/29/01 +, Bernhard wrote: But I'm not using CGI.pm. I don't know what i should do with it. I only want to use Perl. Unfortunately one has to walk before one can run. Your response is akin to saying, I don't want to use a boat; all I want to do is sail across the Atlantic using this pile of cloth and wood. If you plan to do anything else with web programming in perl, your most cost-effective solution is to learn CGI.pm and to learn whatever else you need to learn in order to learn CGI.pm. If this is all you want to do, your most cost-effective solution is to find someone else to do it for you, probably at a fee. Sorry; that's just the way it is. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com
Re: Fileposting
--- Bernhard [EMAIL PROTECTED] wrote: But I'm not using CGI.pm. I don't know what i should do with it. I only want to use Perl. Hmmm Well, if you're just trying to learn Perl and the HTTP protocol, and want to print and read and parse simple forms, then ok I guess but for anything more complex than the simplest forms, and for any real production work, use the module. As for a file upload, just save yourself a straightjacket, skip to the chase scene, and use the module. =o) __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: Fileposting
[back to the list] At 10:24 PM 5/29/01 +, you wrote: But i have already programmed a Guestbook, and a Password protection for a Webcam. Also i have programmed a color Voting Program fpr my Homepage, and a program that shows the stats of the votes. Now I'm working at a Site where singles can add their Information, and find other users. That's where the problem with the file sending came up, because i'd like to give the Users a chance to upload a picture from them. So if you could give me a small code that saves an uploaded picture in a definded directory I would be happy! use CGI qw(:all); use CGI::Carp qw(fatalsToBrowser); my $fh = param('upload'); my ($name) = ($fh =~ /([\w.-]+)/; open (OUT, $name) or die Can't open $name: $!; my $buf; print OUT $buf while read $fh, $buf, 1024; close OUT; I doubt you'll find many people who want to reinvent the CGI.pm wheel for you. If you've learned all those other things it won't take you long to pick it up. thx Bernhard At 07:45 PM 5/29/01 +, Bernhard wrote: But I'm not using CGI.pm. I don't know what i should do with it. I only want to use Perl. Unfortunately one has to walk before one can run. Your response is akin to saying, I don't want to use a boat; all I want to do is sail across the Atlantic using this pile of cloth and wood. If you plan to do anything else with web programming in perl, your most cost-effective solution is to learn CGI.pm and to learn whatever else you need to learn in order to learn CGI.pm. If this is all you want to do, your most cost-effective solution is to find someone else to do it for you, probably at a fee. Sorry; that's just the way it is. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com
RE: Fileposting
Bernhard writes .. Hi! I'm using a html form, where you can enter a file (a picture) and upload it, but when i send the form the Perl script only gets the local Adress of the file, but not the Data (so the picture) of the file. How can i save the picture in a new file on my Disk? I have programmed it so that the new file will be saved in a new Folder. if you use the standard CGI module that's shipped with the later versions of Perl then that parameter is both the filename and a filehandle to the file contents as well since version 2.47 of CGI.pm there's an additional method called 'upload' which explicitly retrieves the filehandle see the CGI documentation for an example of the file-upload mechanism references: perldoc CGI -- jason king In Denmark, if a horse carriage is trying to pass a car and the horse gets uneasy, the car is required to pull over and stop. If necessary to ease the horse down, you are required to cover the car up. - http://dumblaws.com/