LookingBeyond99
Programmer
My question is pretty simple. I'm uploading a file from a user and trying to upload it to a server. However for some reason I can't open up a new file to store the information.
open(FILE, ">$filepath"
;
print FILE $CGI{'upload'}->{'Contents'};
close (FILE) || die "Error close filehandle: $!";
$filepath has the path on the server which includes the name of the file to to be created. For some reason this only works if a file is already there and replaces that file with the new contents. But if the file doesn't already exist then it returns an error. I thought the > means that if a file didnt already exist it would create it.
I also have tried adding this line after the open
chmod 0666, '$filepath';
but it doesn't seem to help but I think I'm doing something dumb.
open(FILE, ">$filepath"
print FILE $CGI{'upload'}->{'Contents'};
close (FILE) || die "Error close filehandle: $!";
$filepath has the path on the server which includes the name of the file to to be created. For some reason this only works if a file is already there and replaces that file with the new contents. But if the file doesn't already exist then it returns an error. I thought the > means that if a file didnt already exist it would create it.
I also have tried adding this line after the open
chmod 0666, '$filepath';
but it doesn't seem to help but I think I'm doing something dumb.