scarshin09
New member
i have an 'edit function' on the website that i am working on.
the form of that page contains an upload of picture..
php1
<input type="file" name="pic" />
<input type="hidden" name="delpic" value="<SQL statement, retrieve filename >" />
---------------------------------------------------------
php2
if ($_FILES['pic']['type'] == "image/jpeg") {
if($file_size >= $limit_size)
echo "Your file size is over limit!";
else {
if(move_uploaded_file($_FILES['pic']['tmp_name'], $path)) {
$delpath = "photos/".$delpic;
unlink($delpath);
echo "Successful!";
}
else
echo "Sorry, there was a problem uploading your file.";
}
}
else {
echo "Bad File Type";
}
Question:
there are instances that the user will no longer want to change his picture.
how will php know that the there is no value for variable 'pic' in the first php code?
i only allow one picture. <the reason is another long story>^^
please do help me..^^
the form of that page contains an upload of picture..
php1
<input type="file" name="pic" />
<input type="hidden" name="delpic" value="<SQL statement, retrieve filename >" />
---------------------------------------------------------
php2
if ($_FILES['pic']['type'] == "image/jpeg") {
if($file_size >= $limit_size)
echo "Your file size is over limit!";
else {
if(move_uploaded_file($_FILES['pic']['tmp_name'], $path)) {
$delpath = "photos/".$delpic;
unlink($delpath);
echo "Successful!";
}
else
echo "Sorry, there was a problem uploading your file.";
}
}
else {
echo "Bad File Type";
}
Question:
there are instances that the user will no longer want to change his picture.
how will php know that the there is no value for variable 'pic' in the first php code?
i only allow one picture. <the reason is another long story>^^
please do help me..^^