File upload when not change on Mod?
I am trying to get a page that modifies a record to either upload the new file OR use the prior file name IF no upload happens.
This works in many prior iterations so not sure why I am getting blank upload value at this point.
Reviewed this prior post which looks to confirm the hidden field is the proper way to achieve the goal:
http://www.webassist.com/forums/posts.php?id=31952
Details;
Update attempts:
Using the File Field value:
$UpdateQuery->bindColumn("InvImage", "s", "".((isset($_FILES["invImage"]))? preg_replace('/.[^.]*$/', '', $_FILES["invImage"]["name"]) :"") ."", "WA_DEFAULT”);
Server side:
$UpdateQuery->bindColumn("InvImage", "s", "".$WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_2"]["serverFileName"] ."", "WA_DEFAULT”);
Hidden File name of current file:
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../../ ".$MemberDirectory ."/InvtryImages/",
'FileName' => "[FileName]",
'DefaultFileName' => "".((isset($_POST["imageName"]))?$_POST["imageName"]:"") ."",
'ResizeType' => "2",
'ResizeWidth' => "1200",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "../../".$MemberDirectory ."/InvtryImages/thumbnails/",
'FileName' => "[FileName]",
'DefaultFileName' => "".((isset($_POST["imageName"]))?$_POST["imageName"]:"") ."",
'ResizeType' => "2",
'ResizeWidth' => "159",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] === "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "invImage", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>
I've guaranteed the hidden value is present.
<input type="hidden" id="imageName" name="imageName" value="<?php echo($Product->getColumnVal("InvImage")); ?>" >
Page uploads and saves the uploaded file name properly just that when there is NO new file uploaded I get a blank record.
Anything else I should be checking?