PDA

View Full Version : Uploading files - update - DFPv2


john.molitor259030
05-25-2009, 08:25 AM
Hello, I use digital file Pro 113 with Dreaweaver CS3 under winXP pro sp3 (now DigitalFilePro v2)

ItemID = 29
ItemCatID = 5
ItemAnnee = 2008
ItemAuteur = XY
ItemName = Nom
ItemDesc = Descript.
ItemThumb = small_image.jpg
ItemImage = big_image.jpg

With digital file Pro 113, it was necessary to a field for the thumbnail and a field for the large image (detail page).
Following the procedure "Uploading files: update - interactive tutorial", works very well.

I discovered the DigitalFilePro v2, I've been interested in (productshot - small wide) image resizing.
What has seduced me also was the ability to resize in two sizes, put them on the server in different folders and enter the name of the image in the database.

Unfortunately, I followed the procedure for the 113 version and in the cases where change year or the author, but sought to modify the image. The name of the image is removed from the database.

Clearly the philosophy is not the same between the 113 version and version 2

Here's what reproduced me inspiration from the DigitalFilePro 113 for DigitalFilePro v2 tutorial.
Can you help me?

In FORM UPDATE
<input type="hidden" name="ItemThumb" id="ItemThumb" value="<?php echo(str_replace('"', '&quot;', $row_WADAitems['ItemThumb'])); ?>" size="32" />
<input type="hidden" name="ItemImage" id="ItemImage" value="<?php echo(str_replace('"', '&quot;', $row_WADAitems['ItemImage'])); ?>" size="32" />


In RECORDSET UPDATE
ItemThumb = <?php echo $WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_2"]["serverFileName"]; ?>
ItemImage = <?php echo $WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_1"]["serverFileName"]; ?>


In WA upload file
default file (big) = <?php echo ((isset($_POST["ItemImage"]))?$_POST["ItemImage"]:""); ?>
default file (small) = <?php echo ((isset($_POST["ItemThumb"]))?$_POST["ItemThumb"]:""); ?>


Will we have a small formative video for DigitalFilePro v2?
Please Mark Fletcher ;)

Uploading files: Update (Part 1) (Interactive Tutorial)
Uploading files: Update (Part 2) (Interactive Tutorial)

Thanks
John

fragop363190
05-26-2009, 05:14 AM
Check the Flash Tutorials of DFP2 everything is there.

As soon as i have time ill try posting a Full Guide about creating a full admin panel with DataAssist and DFP2 etc.

Nobody mentions in the forum about deleting files while deleting the record in db...
You need to delete file or youll have your server with too many orphans.
Also when you generate thumbnails you need to add another DELETE behavior for them and need to manualy code the 2nd behavior which should be set after DELETE1 succesfully completes. Manually code for the _thumb or any suffixes you use on the UPload behavior.

I promise ill write a small guide for all people that need it so its step by step.

Hope i helped you.

BTW u need delete file behavior on both update and detail page (if you have added the option to add a delete button there) and delete page if you have it created separately for confirmation.

And if you using thumbs, u need a 2nd 3rd 4th (as many file resizes u got in your upload behavior including your first file, in general as many file things u see in DFP2 file box that you have added you need so many Delete behaviors in the appropriate page to work, but with the 2nd+ behaviors set to run after DELETE1 has been succesfully completed.


This is what u need to manually code in DELETE2 +

<?php
$WA_DeleteFileResult1 = false;
if(isset($_POST["Delete_x"])){
$WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("../assets/images/photos/", $row_WADAimages_img['filename_img']);
}?>
<?php
$WA_DeleteFileResult2 = false;
if($WA_DeleteFileResult1){
$WA_DeleteFileResult2 = WA_FileAssist_DeleteFile("../assets/images/photos/", str_replace(".jpg","_thumb.jpg",$row_WADAimages_img['filename_img']));
}
?>

depending on what extensions you use (i force all to be made jpg as im working with logos and i dont care about transpaency and its easier for delete behavior) you do the str_replace thing. I got 1 thumbnail created. [Filename]_thumb.jpg so i take the original [Filename].jpg and change it to it by using the str_replace function. It is very easy. If you got 5 thumbs, _thumb1,_thumb2 you need to copy paste the <?php ?> code as many times and change the DeleteFileResult2 to DeleteFileResult(numbering) and the _thumb.jpg to _thumb(numbering) etc.

Or you can add the server behavior from the behaviors panel and just add the str_replace thing on the box or manualy after at code.

Hope this helps a lot of people.

By the way, new helper file of DFP2 works properly. Goo job WebAssist.

john.molitor259030
06-09-2009, 07:20 AM
Thank you, but I do not want to delete the image from the server, I just want to edit a field and store the image.

The article exists in the database: I want to change the name or description, but I do not want to change the image.

At each move, during an update, the image name is deleted from the database so I do not want to change it.

For this scenario I am looking for a solution.

Best regards
John

Ray Borduin
06-09-2009, 07:54 AM
This is a bug. Submit a support incident and they will provide a fix. The default value isn't working properly on update pages causing the field to be cleared.