close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DFP db filename gets overwritten on update

Thread began 11/12/2009 11:46 am by contact318852 | Last modified 1/19/2010 4:33 pm by bjgarner241692 | 5474 views | 36 replies |

contact318852

DFP db filename gets overwritten on update

Hi, in a previous forum I posted my question, my issue remains unresolved. Im pasting my question from it to here.

"I was just about to post a thread about this issue as well and saw this so I am tagging my issue here too.

I have DigitalFilePro 2.02 and can update a record, and get filename in database, however if I return to the update form and leave some of the fields blank, it will erase any entry in the database that wasn't updated with a file.

some specs digitialfilepro 2.02
dreamweaver cs3
windows vista home premium
64 bit "

sojowebreplied:
contact,

It sounds like you need to populate your form fields on your update page with the existing values in the database... that way, regardless of whether you edit them or not, the original value is submitted. if you have any questions how to do this, just drop a line here.

Best regards,

Brian
__________________
Brian Michel
SOJO web LLC

--
I replied:
thanks for the prompt reply,

I thought my hidden field was doing that, is this enough code for you to determine if I have entered it correctly? - following the tutorial...

Ive added more code sample here..


// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "images/profile",
'FileName' => "images/profile/".$_SESSION['MemberID'] ."_avatar",
'DefaultFileName' => "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."",
'ResizeType' => "2",
'ResizeWidth' => "120",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End?>

<tr>

<td class="WADADataTableCell"><input type="hidden" name="AvatarFileName" id="AvatarFileName" value="<?php echo(str_replace('"', '&quot;', $row_WADAmember['AvatarFileName'])); ?>" size="32" />
<input type="file" name="AvatarFileNameUPD" id="AvatarFileNameUPD" /></td>

</tr>

Edit> As I explore this more I realize this is strange, some fields seem to work ok and do not get deleted on a new update, others do not. I have manually edited the code to read the existing values, but some fields wont let the edits 'stick' if i go back into the WA Upload files wizzard it occaisionally looses the 'default filename' code.

sojoweb replied.
One thing I noticed is that you have your DFP files flipped... the file you are uploading - meaning $WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] should be in the File Name of the DFP since that is the one that is actually being uploaded or changed. The Default file name is used to specify the image that will be used (typically the previous one uploaded) in the case that there is no image uploaded on the update page. To code this correctly, you should actually store the recordset value from the image field into a hidden field on your form... then inside the DFP dialog box, you would set the Default File to the hidden form field containing your image value from the original recordset.

Also, with the rest of your fields on the form, be sure that you are actually just populating the input fields themselves... you shouldn't need to use hidden fields for the non-image or non-file upload fields.

Regards,

Brian
__________________
Brian Michel
SOJO web LLC

Sign in to reply to this post

contact318852

Sorry for the thread confusion..

Sojo thank you for your input, I am following this tutorial dfp_da_insert_update_ht.pdf

so the order of the dfp files that you mention are 'flipped' are in that order - as far as I can tell from following the tutorial.

I have tried now almost all possible combinations, and would like to request a support ticket if possible.

Sign in to reply to this post

Jason ByrnesWebAssist

In the code above, you are not using the hidden field for the Ddefulat File bname, you are using the Server File name:
'DefaultFileName' => "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."",



you need to bind the Default file to the hidden form element from the form collection.

Sign in to reply to this post

contact318852

Thank you,

Yes, I have tried that and the overwriting of the un-updated db fields continues even with the change.

this is what the code for the page looks like now,, I hvae pasted only the code that applies to one of my 20 fields...


// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "images/profile",
'FileName' => "".$_SESSION['MemberID'] ."_avatar",
'DefaultFileName' => "".((isset($_POST["AvatarFileName"]))?$_POST["AvatarFileName"]:"") ."",
'ResizeType' => "2",
'ResizeWidth' => "120",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End?>


Form Field

<tr>
<th width="83" class="WADADataTableHeader"><img src="images/profile/<?php echo $row_WADAmember['AvatarFileName']; ?>" width="50" /></th>
<td width="264" class="WADADataTableCell"><input type="hidden" name="AvatarFileName" id="AvatarFileName" value="<?php echo $row_WADAmember['AvatarFileName']; ?>" size="32" />
<input type="file" name="AvatarFileNameUPD" id="AvatarFileNameUPD" /></td>
<td width="234" class="WADADataTableCell"><input type="text" name="avatar_caption" id="avatar_caption" value="<?php echo(str_replace('"', '&quot;', $row_WADAmember['avatar_caption'])); ?>" size="32" /></td>
</tr>


upload stat struct....

<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "AvatarFileNameUPD", "0", "", "JPG:80", $WA_UploadResult1_Params);
}
?>

------
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $microstock;
$WA_table = "member";
$WA_redirectURL = "profileimg_Results.php";
$WA_keepQueryString = false;
$WA_indexField = "MemberID";
$WA_fieldNamesStr = "AvatarFileName|ProfileImg_1|ProfileImg_2|ProfileImg_3|ProfileImg_4|ProfileImg_5|ProfileImg_6|ProfileImg_7|ProfileImg_8|ProfileImg_9|ProfileImg_10|avatar_caption|caption_1|caption_2|caption_3|caption_4|caption_5|caption_6|caption_7|caption_8|caption_9|caption_10";
$WA_fieldValuesStr = "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult2"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult3"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult4"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult5"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult6"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult7"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult8"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult9"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult10"]["serverFileName"] ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult11"]["serverFileName"] ."" . "|" . "".((isset($_POST["avatar_caption"]))?$_POST["avatar_caption"]:"") ."" . "|" . "".((isset($_POST["caption_1"]))?$_POST["caption_1"]:"") ."" . "|" . "".((isset($_POST["caption_2"]))?$_POST["caption_2"]:"") ."" . "|" . "".((isset($_POST["caption_3"]))?$_POST["caption_3"]:"") ."" . "|" . "".((isset($_POST["caption_4"]))?$_POST["caption_4"]:"") ."" . "|" . "".((isset($_POST["caption_5"]))?$_POST["caption_5"]:"") ."" . "|" . "".((isset($_POST["caption_6"]))?$_POST["caption_6"]:"") ."" . "|" . "".((isset($_POST["caption_7"]))?$_POST["caption_7"]:"") ."" . "|" . "".((isset($_POST["caption_8"]))?$_POST["caption_8"]:"") ."" . "|" . "".((isset($_POST["caption_9"]))?$_POST["caption_9"]:"") ."" . "|" . "".((isset($_POST["caption_10"]))?$_POST["caption_10"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";

----
Your helps is appreciated..

Sign in to reply to this post

Jason ByrnesWebAssist

Can you send the whole php page in a zip file so I can see the code for the entire page rather than snippets.

Sign in to reply to this post

contact318852

sure here it is

Attached Files
profileimg_update-working.zip
Sign in to reply to this post

Jason ByrnesWebAssist

What happens if you change:

php:
<input type="hidden" name="AvatarFileName" id="AvatarFileName" value="<?php echo $row_WADAmember['AvatarFileName']; ?>" size="32" />




to:

php:
<input type="text" name="AvatarFileName" id="AvatarFileName" value="<?php echo $row_WADAmember['AvatarFileName']; ?>" size="32" />





does the AvatarFileName text box have a value?

Sign in to reply to this post

contact318852

yes, its value remains <?php echo $row_WADAmember['AvatarFileName']; ?>

the same issue lingers.. if i update any field in the form any file fields that are blank get erased

to ensure we are on the same 'page'

1, if I update all file upload fields at once the image, and the inserted db filename behave as expected - and are returned to the form and display.
2. the 'caption' text fields are not getting erased, on any update, and update as intended.
3. the filename file field in the database gets erased even if I just update one of the 'caption fields' , or update one file field.

I am not well versed in this - but id hazzard a guess that 'something' is getting passed to the dbfilefields and causing an overwrite of the existing entry, but whatever that data is that gets passed im at a loss to understand.

Sign in to reply to this post

Jason ByrnesWebAssist

I'm not asking about the value in the code, I am asking when you view the page in the browser, does the AvatarFileName text box show a value.

in other words does the text box show a value before you update the page when viewing the page in a browser?

Sign in to reply to this post

contact318852

yes it shows the correct filename entry in the browser, but that value also gets erased on a partial update

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...