close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How do you store image path to database?

Thread began 4/30/2009 8:37 pm by mkondakow248259 | Last modified 5/04/2009 2:33 pm by mkondakow248259 | 7574 views | 9 replies |

mkondakow248259

How do you store an image path on to a database field?

I'm trying to store the path to my images into my MySql database. The problem is that the path is recorded but the dashes are not present?

i.e. I should get "\images\hiking\trees.jpg " instead i get "imageshikingtrees.jpg "

Also can DFP create directories on the server from a database field such as the persons unique Id_user field?

Sign in to reply to this post

Ray BorduinWebAssist

If the proper permissions are set it should create directories that are specified and don't exist.

If you want the server directory, that is a separate binding from the server file name. Just combine the two in the insert and update server behavior if you want both stored.

Sign in to reply to this post

mkondakow248259

Hello Ray
Tried your suggestion with no results.
All I'm getting is the uploaded filename in the root directory.

Spent too many hours on what should be simple.
I have a local wamp server with all permisions on.
Lets try again.
First step I want to creat a directory on the server called images.(currently it doesn't exsist)
Please give me the steps (detailed) for the server behaviours for DFP , Data assist insert file and update file.

When we get that figured out i need the instructions to record the path to the images folder and file names in my database field.

Sign in to reply to this post

Ian

By design DFP wont store the path to the file in the database. It stores the file name.

You can then simply add the path to the dynamic image on the detail page so it would read something like

/public/images/members/<%=rs_member.fields.item("image")%>

All upload components I have used only ever store the image name. You may be able to store the directory using the bindings for DFP - not sure, never tried it.

Sign in to reply to this post

mkondakow248259

Thanks Ian
That is a great suggestion.

Do you know if DFP will create a new directory if it doesn't exsist yet on the server?

I.E.
I tried an expieriment, made a directory called images. Followed the DFP wizard and my file was upload to directory images.
Now if i remove the directory and try the whole process again DFP does not create the requested directory called images.
Is this another feature that DFP not do?

Sign in to reply to this post

Ian

Hi,

Yes, from my experience, as long as the parent directory of the upload path has permissions to create directories then DFP will automatically create it if it doesnt exist.

This is true on a Windows box and an ASP site. I am relatively new to PHP and don't have much experience of using DFP on PHP but I assume that functionality will be the same across platforms.

Cheers
Ian

Sign in to reply to this post

mkondakow248259

Thanks Ian

Ok so you have confirmed that a new directory can be created on a Windows box with ASP.

Can some one from Webassist confirm if this is true with a windows box running PHP?

Sign in to reply to this post

Danilo Celic

In some circumstances, the folder won't be created. In fact this is one of the fixes that will be in the next update of Digital File Pro V1. Sorry I can't give any dates as testing is still underway.

However, if you open up this file:
WA_DigitalFilePro/HelperPHP.php

And go down to the bottom and look for the rootRelativeToFullFileURLfunction and replace it with the following:
function rootRelativeToFullFileURL($folderPath){
if(strpos($folderPath, "/") === 0){
$scriptName = $_SERVER['SCRIPT_NAME'];
$currentFilePath = realpath(basename($scriptName));
$replaceBackSlash = preg_replace('/\\\/', '/', $currentFilePath);
$scriptNameRegEx = "/".preg_replace("/\\//", "\\/", $scriptName)."$/";
$folderPath = preg_replace($scriptNameRegEx,"", $replaceBackSlash).$folderPath;
}
else{
$separator= WA_DFP_GetFileSeparator();
// Use correct separator
$origFolderPath = preg_replace('/\\\|\\//', $separator, $folderPath);
$folderPath = realpath('./').$separator.$origFolderPath;
// drop any trailing slash, as realpath doesn't return it either.
$folderPath = preg_replace("/\\".$separator."$/", "", $folderPath);
}
return $folderPath;
}

That should help make sure the folder is getting created. If not, then please do log a support incident as your specific setting may lead to a different issue.

Sign in to reply to this post

Danilo Celic

Oh, one note. Please keep that snippet on hand, as each time you make an update or add a new instance of any of the Digital File Pro server behaviors (Delete, Download, Rename, Upload) will overwrite this change. So make sure to keep this code chunk around to make the change again.

Sign in to reply to this post

mkondakow248259

Thanks Danilo

Thats what I needed to know.

I'm Glad your team is working on DFP updates.
Its a fundamental module for CMS work

Mickey

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...