CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
perl writing file in htdocs

 



gerble1000
User

Dec 22, 2011, 11:53 AM

Post #1 of 3 (1007 views)
perl writing file in htdocs Can't Post

i am having trouble puting an image into the htdocs folder.
a can get it into cgi-bin fine.. here is my code


Code
$CGI::POST_MAX = 1024 * 50000; 
my $safe_filename_characters = "a-zA-Z0-9_.-";
my $upload_dir = "testfolder";

my $query = new CGI; my $filename = $query->param("uploadfile1");

my $upload_filehandle = $query->upload("uploadfile1");
open ( UPLOADFILE, ">$upload_dir/1.jpg" ) or die "$!"; binmode UPLOADFILE; while ( <$upload_filehandle> ) { print UPLOADFILE; } close UPLOADFILE;

and this is the actual windows path to my htdoct
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\

can you give me the sintax to put in please


hostage
Novice

Jan 24, 2012, 12:22 AM

Post #2 of 3 (644 views)
Re: [gerble1000] perl writing file in htdocs [In reply to] Can't Post

do "testfolder" exists ???


rovf
Veteran

Jan 24, 2012, 5:49 AM

Post #3 of 3 (641 views)
Re: [gerble1000] perl writing file in htdocs [In reply to] Can't Post

(1) Does the "open" call succeed, and if not, what error does it return?

(2) In your case, it is easier to use File::Copy instead writing your own loop (but if you run into problems, errors are more difficult to diagnose).

(3) Do you have


Code
use warnings; 
use strict;


in your code?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives