Hi again, gosh, this place is so usefull, and I really appreciate all the help I get here, without you all, I'd be totaly lost.
Anyway, Im trying to delete a file from the server, of couse I don't know how to write the right coding so what I've done is to rename the file to a null file name in the meantime, but Im hoping someone can actually tell me how to properly write the following to delete the file instead of renameing it.
$user = $FORM{'user'};
$photo = $FORM{'photo'};
$action = $FORM{'action'};
use DBI;
$dbh = DBI->connect("dbi:mysql:$mysqldatabase","$mysqlusername","$mysqlpassword") || die("Couldn't connect to database!\n");
print "Content-Type: text/html\n\n";
#&printheader;
&getprofilenumber;
&savedata;
&printconfirmation;
&printfooter;
$filename = $user;
chdir ("$memberimagesfolderpath");
rename ("$user","245tghyu4g3645y.gif");
You'll notice above that I have the rename ("$user","245tghyu4g3645y.gif");
when I should really have some way of deleting the file instead of just renaming it. Though it does work this way, I would prefer to just delete the file instead.
Also, Im trying to figure out a way of working within the following block of coding to check if the incoming file is a jpg or a gif and if not toss them an error message. I have looked at the upload mod in the resource center, but it has me totaly lost as how I could possibly mod the mod to work for my situation.
require "cgi-lib.pl";
$ret = &ReadParse;
print "Content-Type: text/html\n\n";
&CgiDie("Error in reading and parsing of CGI input") if !defined $ret;
&CgiDie("No data uploaded") if !$ret;
$in{'upfile'} =~ s/</</g;
$in{'upfile'} =~ s/>/>/g;
$uploaded = $in{'upfile'};
$filename = $member;
chdir ("$memberimagesfolderpath");
rename ("$uploaded","$filename");
$image = "$memberimagesfolderURI/$filename";
Any help is as usual greatly appreciated.
Harrison
"I've got if's pretty good, but that's about it"
Anyway, Im trying to delete a file from the server, of couse I don't know how to write the right coding so what I've done is to rename the file to a null file name in the meantime, but Im hoping someone can actually tell me how to properly write the following to delete the file instead of renameing it.
$user = $FORM{'user'};
$photo = $FORM{'photo'};
$action = $FORM{'action'};
use DBI;
$dbh = DBI->connect("dbi:mysql:$mysqldatabase","$mysqlusername","$mysqlpassword") || die("Couldn't connect to database!\n");
print "Content-Type: text/html\n\n";
#&printheader;
&getprofilenumber;
&savedata;
&printconfirmation;
&printfooter;
$filename = $user;
chdir ("$memberimagesfolderpath");
rename ("$user","245tghyu4g3645y.gif");
You'll notice above that I have the rename ("$user","245tghyu4g3645y.gif");
when I should really have some way of deleting the file instead of just renaming it. Though it does work this way, I would prefer to just delete the file instead.
Also, Im trying to figure out a way of working within the following block of coding to check if the incoming file is a jpg or a gif and if not toss them an error message. I have looked at the upload mod in the resource center, but it has me totaly lost as how I could possibly mod the mod to work for my situation.
require "cgi-lib.pl";
$ret = &ReadParse;
print "Content-Type: text/html\n\n";
&CgiDie("Error in reading and parsing of CGI input") if !defined $ret;
&CgiDie("No data uploaded") if !$ret;
$in{'upfile'} =~ s/</</g;
$in{'upfile'} =~ s/>/>/g;
$uploaded = $in{'upfile'};
$filename = $member;
chdir ("$memberimagesfolderpath");
rename ("$uploaded","$filename");
$image = "$memberimagesfolderURI/$filename";
Any help is as usual greatly appreciated.
Harrison
"I've got if's pretty good, but that's about it"