Hi,
Now do I need help here. i have a third party script that allows the user to upload a picture from their computer to the site.
What I would like to do depending on the situation is IF certain criteria are met then a choice to allow them to browse their computer or a server side folder to choose a picture to use..
The problem is being a newbie I do not fully understand where the changes have to be made for the the choice for the user of the user computer or server folder in the browser popup window.
I now that a java script controls the popup, but where does the picture url section allow my proposed alteration.
I think this is the HTML section....
<!------------------------- URL of photo ------------------>
<?
if(!empty($TPL_pict_URL_value)) {
?>
<TR>
<TD WIDTH="352" VALIGN="middle"
ALIGN="right"><? print $std_font; ?>
<B> <? print $MSG_938; ?> </B> </TD>
<TD WIDTH="535" valign= "top">
<INPUT TYPE=HIDDEN NAME=upd_pict_url VALUE="<? print $sessionVars["SELL_pict_url"]; ?>">
<? print $std_font; ?> <? print $TPL_pict_URL_value; ?> </TD>
</TR>
<?
}
?>
and this the PHP....
// $sessionVars=array();
if(isset($upd_pict_url)) {
$sessionVars["SELL_pict_url"] = $upd_pict_url;
$sessionVars["SELL_file_uploaded"] = $imgtype;
}
if($imgtype==1 && !empty($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != "none") {
// move uploaded file in right place
//set uploaded file path session variable
//empty linked file path session variable
$inf = GetImageSize ($_FILES['userfile']['tmp_name']);
$er = false;
// make a check
if ($inf) {
$inf[2] = intval($inf[2]); // check for uploaded file type
if ( $inf[2]<1 || $inf[2]>3 ) {
$er = true;
$ERR = "ERR_602";
} elseif ( intval($userfile_size) > $SETTINGS['maxuploadsize'] ) {
$er = true;
$ERR = "ERR_603";
} else {
switch($inf[2]) {
case 1: $ext=".gif";
break;
case 2: $ext=".jpg";
break;
case 3: $ext=".png";
break;
}
$uploaded_filename = $auction_id.$ext;
$fname = $image_upload_path.$uploaded_filename;
if (file_exists($fname)) {
unlink ($fname);
}
move_uploaded_file($_FILES['userfile']['tmp_name'],$fname);
chmod($fname,0666);
$sessionVars["SELL_pict_url"] = $uploaded_filename;
$sessionVars["SELL_file_uploaded"] = $imgtype;
}
} else {
$ERR = "ERR_602";
$er = true;
}
} elseif($imgtype==0 && !empty($pict_url)) {
//control if uploaded file path session variable
//if yes delete already uploaded files
//empty uploaded file path session variable
//if ($sessionVars["SELL_file_uploaded"]) {
// unlink($image_upload_path.$sessionVars["SELL_pict_url"]);
//}
$ext=strtolower(substr($pict_url,-3));
if($ext!="gif" && $ext!="jpg" && $ext!="png") {
$ERR = "ERR_602";
} else {
$sessionVars["SELL_pict_url"] = $pict_url;
$sessionVars["SELL_file_uploaded"] = $imgtype;
now all this is heavey going for me, a mere mortal...help from the brains amongst you is appreciated..
Cheers
John
FLASH is my game.........
Now do I need help here. i have a third party script that allows the user to upload a picture from their computer to the site.
What I would like to do depending on the situation is IF certain criteria are met then a choice to allow them to browse their computer or a server side folder to choose a picture to use..
The problem is being a newbie I do not fully understand where the changes have to be made for the the choice for the user of the user computer or server folder in the browser popup window.
I now that a java script controls the popup, but where does the picture url section allow my proposed alteration.
I think this is the HTML section....
<!------------------------- URL of photo ------------------>
<?
if(!empty($TPL_pict_URL_value)) {
?>
<TR>
<TD WIDTH="352" VALIGN="middle"
ALIGN="right"><? print $std_font; ?>
<B> <? print $MSG_938; ?> </B> </TD>
<TD WIDTH="535" valign= "top">
<INPUT TYPE=HIDDEN NAME=upd_pict_url VALUE="<? print $sessionVars["SELL_pict_url"]; ?>">
<? print $std_font; ?> <? print $TPL_pict_URL_value; ?> </TD>
</TR>
<?
}
?>
and this the PHP....
// $sessionVars=array();
if(isset($upd_pict_url)) {
$sessionVars["SELL_pict_url"] = $upd_pict_url;
$sessionVars["SELL_file_uploaded"] = $imgtype;
}
if($imgtype==1 && !empty($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != "none") {
// move uploaded file in right place
//set uploaded file path session variable
//empty linked file path session variable
$inf = GetImageSize ($_FILES['userfile']['tmp_name']);
$er = false;
// make a check
if ($inf) {
$inf[2] = intval($inf[2]); // check for uploaded file type
if ( $inf[2]<1 || $inf[2]>3 ) {
$er = true;
$ERR = "ERR_602";
} elseif ( intval($userfile_size) > $SETTINGS['maxuploadsize'] ) {
$er = true;
$ERR = "ERR_603";
} else {
switch($inf[2]) {
case 1: $ext=".gif";
break;
case 2: $ext=".jpg";
break;
case 3: $ext=".png";
break;
}
$uploaded_filename = $auction_id.$ext;
$fname = $image_upload_path.$uploaded_filename;
if (file_exists($fname)) {
unlink ($fname);
}
move_uploaded_file($_FILES['userfile']['tmp_name'],$fname);
chmod($fname,0666);
$sessionVars["SELL_pict_url"] = $uploaded_filename;
$sessionVars["SELL_file_uploaded"] = $imgtype;
}
} else {
$ERR = "ERR_602";
$er = true;
}
} elseif($imgtype==0 && !empty($pict_url)) {
//control if uploaded file path session variable
//if yes delete already uploaded files
//empty uploaded file path session variable
//if ($sessionVars["SELL_file_uploaded"]) {
// unlink($image_upload_path.$sessionVars["SELL_pict_url"]);
//}
$ext=strtolower(substr($pict_url,-3));
if($ext!="gif" && $ext!="jpg" && $ext!="png") {
$ERR = "ERR_602";
} else {
$sessionVars["SELL_pict_url"] = $pict_url;
$sessionVars["SELL_file_uploaded"] = $imgtype;
now all this is heavey going for me, a mere mortal...help from the brains amongst you is appreciated..
Cheers
John
FLASH is my game.........