View Full Version : Record complete image URL
Garry Wilmeth
06-02-2009, 01:53 PM
Hello,
How can I get DFP to record the full URL of the image in the database instead of just recording the file name?
Thanks,
Garry
Ray Borduin
06-02-2009, 03:59 PM
There are bindings for all parts of the url and file name, and you can just type in the full url manually when you do the insert or update.
So if your binding is currently: <?php echo($yourUploadFileName); ?>
You could just update it to: http://www.yoursite.com/yourdirectory/<?php echo($yourUploadFileName); ?>
Garry Wilmeth
06-17-2009, 09:48 AM
Where would I add the URL... Not sure I understand the directions.
Ray Borduin
06-17-2009, 10:11 AM
You would add it before the value that you have specified in the user interface so that it would appear in front and show the complete url.
You would update and add the url in the location where it is missing. You want it in the database in a particular column... so add it in the interface where you specify the value that is inserted into that column.
Garry Wilmeth
06-17-2009, 11:28 AM
Would that be in the WA Upload Files server behavior or the Update Record server behavior?
Ray Borduin
06-17-2009, 11:48 AM
The update record server behavior.
Garry Wilmeth
06-17-2009, 12:01 PM
OK... that is where I had it before and the problem that I run into is having the URL inserted on update when I am not updating the photos in the record. This method causes the default hidden value to be ignored and the URL gets inserted into the database instead. This in turn wipes out the path to my photos.
Ray Borduin
06-17-2009, 12:31 PM
OK... well lets fix that problem.
What exactly happens? What default hidden value? Do you have the update installed? It had an issue with the default value not working in general.
Please describe exactly what you do when the error occurs with this technique... what the exact result is and what the expected result is. I think we can fix the problem if I understand it better.
Garry Wilmeth
06-17-2009, 06:38 PM
I created an admin section using data assist. I followed the procedure for digital file pro to edit the update form so in the event that I am editing something other than the photos, the update form would apply the database values via the hidden form element. This works great if I just want to store the file name in the database field and not the full path.
When I adjust the update form to insert the path as well, it causes problems when I submit the update form without attaching new photos. Instead of reapplying the already existing database values, it inserts the URL that I have added in the binding minus the file name (because one does not exist in the file upload field).
I hope that makes sense...
Ray Borduin
06-18-2009, 08:49 AM
It shouldn't work like that. I would like to look at your code. Please post a support incident and include a copy of your update page. I think that can be corrected with a conditional statement so that the url is not added when the field was not updated.
so instead of:
http://www.yoursite.com/yourdirectory/<?php echo($yourUploadFileName); ?>
you use something like:
<?php echo(($yourUploadStatus==1)?"http://www.yoursite.com/yourdirectory/":""); ?><?php echo($yourUploadFileName); ?>
This would only add the http:// at the front if the upload status is equal to 1 (if the file was uploaded). The way you reference the updlaod status depends on the upload field on the page but you can drag it from the bindings for reference.
Garry Wilmeth
06-19-2009, 08:44 AM
I just submitted a ticket and attached the code for the page...
ticket # 100300
Thanks for your help!
Garry
Ray Borduin
06-19-2009, 08:45 AM
Did you try my suggested fix?
Garry Wilmeth
06-19-2009, 10:39 AM
Not sure how to apply that... Please check my file and give me an example.
Thanks so much for your help.
Garry
Ray Borduin
06-19-2009, 10:55 AM
When you set the value in the database update server behavior...
so instead of:
http://www.yoursite.com/yourdirectory/<?php echo($yourUploadFileName); ?>
you use something like:
<?php echo(($yourUploadStatus==1)?"http://www.yoursite.com/yourdirectory/":""); ?><?php echo($yourUploadFileName); ?>
Garry Wilmeth
06-19-2009, 11:26 AM
OK... Tried that and on update it just clears the database field instead of leaving the previous data intact.
Ray Borduin
06-19-2009, 11:41 AM
Do you use the updated .php include file available in your order history? That could be the bug that is fixed with that update.
Garry Wilmeth
06-19-2009, 12:04 PM
What updated .php include file are you referring to?
Ray Borduin
06-19-2009, 12:14 PM
Look in your order history for DFP v2. It should be included with an explanation of how to use it.
Garry Wilmeth
06-19-2009, 12:33 PM
Are you referring to this?
Issue: Default file for Insert Server Behavior set incorrectly
When setting either a Static and Dynamic value for the default file setting in the Upload wizard, unless you hit the <Enter> key after setting it, or <Tab> out of that field, the setting will not be retained. In addition, even when this setting is retained during configuration, if no file is uploaded, the default file name is not used for the serverFileName set in the HelperPHP.php file.
Ray Borduin
06-19-2009, 12:34 PM
That is what I am referring to.
Garry Wilmeth
06-19-2009, 01:02 PM
That is not the problem. I did run in to that problem, but noticed that if I press enter in the value field it takes my settings. Let me start over just in case I have lost you...
I originally set up the Data Assist admin section using Data Assist and Digital File Pro. I followed the directions in the following solution:
http://assets.webassist.com/solutionrecipes/112_digital_file_pro/06_upload_update_pt1.swf
and
http://assets.webassist.com/solutionrecipes/112_digital_file_pro/07_upload_update_pt2.swf
and everything worked great!
Recently, one of our vendors asked that we put the full URL before the file name in our database so they can easily integrate our data into their web site.
I made the changes to all data assist pages and everything works OK except the update page.
If I add the URL to the update behavior, it always inserts the URL. This happens regardless of whether or not a new file is being uploaded. For example...
Lets say I have the following in my database field:
http://www.mydomain/folder/filename.jpg
If I run an update and DO NOT upload a new file, the update behaviors changes it to this:
http://www.mydomain/folder/
Then I tried your suggestion to add a condition and now it just empties the database field.
I am desperate for a solution... Thanks for your help.
Ray Borduin
06-19-2009, 01:18 PM
There are two parts to that problem:
Issue: Default file for Insert Server Behavior set incorrectly
1) When setting either a Static and Dynamic value for the default file setting in the Upload wizard, unless you hit the <Enter> key after setting it, or <Tab> out of that field, the setting will not be retained.
2) In addition, even when this setting is retained during configuration, if no file is uploaded, the default file name is not used for the serverFileName set in the HelperPHP.php file.
It sounds like you have accounted for #1 but not #2
Garry Wilmeth
06-19-2009, 01:40 PM
OK... Missed that. So I applied the patch and now the default file works on update.
Now I just need to figure out how to get the condition to work properly. I am not sure what to enter in the condition itself...
I am assuming that I replace $yourUploadStatus with info from my existing file? This is what I have tried...
<?php echo(($WA_DFP_UploadStatus==1)?" http://www.mydomain.com/folder/":""); ?>
Also, is it correct to place the condition in the value field for each image on the update behavior just in front of the existing code for those sections?
Ray Borduin
06-19-2009, 02:20 PM
$WA_DFP_UploadStatus["youruploadname"]["statusCode"]
Garry Wilmeth
06-19-2009, 02:52 PM
Like this??
<?php echo(($WA_DFP_UploadStatus["serverFileName"]["WA_UploadResult1"]==1)?" http://www.mydomain.com/folder/":""); ?>
Garry Wilmeth
06-19-2009, 03:03 PM
Nevermind... that doesn't work. I'm just not getting it.
Ray Borduin
06-19-2009, 03:11 PM
You are close:
<?php echo(($WA_DFP_UploadStatus["WA_UploadResult1"]["statusCode"]==1)?" http://www.mydomain.com/folder/":""); ?>
You can drag and drop the status code from the bindings panel to find the correct syntax for how to refer to the status code.
Garry Wilmeth
06-19-2009, 03:23 PM
Got it!
Thanks for your patience :)
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.