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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Inserting file name in database

Thread began 10/18/2009 1:15 pm by roger.mealey391472 | Last modified 10/19/2009 3:57 pm by Jason Byrnes | 1689 views | 9 replies |

roger.mealey391472

Inserting file name in database

Hello,

I just started using Digital File Pro today and have a question. I've got the file upload working correctly but I need to insert the file name that is uploaded into a column in my database so that I can retrieve either the name alone or the file path so I can display it.

I'm using the dynamic "server file name" as the new name of the uploaded file. I've placed a hidden field in the same div as the file upload field and I then dragged the "server file name" dynamic listing from the bindings panel onto the hidden field. It seems like this should work but it's not. The MySql column is set to VARCHAR 150, null.

Here's some more background on the form in case it means anything. I have 6 text fields in the form along with 1 check box field with about 10 check boxes. I've got 4 file upload fields for the image uploads where I've created a hidden field to set the server behavior for DFP and I'm using the trigger of a single "submit" button.

Here's the code for the hidden field that's used for the server behavior:
<input name="upload1" type="hidden" id="upload1" value="Upload Photo" />

And here's the one that I'm using to hopefully populate the filename or path and insert into the database:
<input name="hiddenField" type="hidden" id="hiddenField" value="<?php echo $WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]; ?>" />

Any suggestions on how I should do this?

I'm very new to web design and PHP so please keep that in mind with any replies. Just an old fart here and learning this PHP has a tendency to fry my brain at times.

Thanks in advance,

Roger

Sign in to reply to this post

anonymous

Roger,

You won't actually need to set the value in a hidden field... it is actually much easier than this... simply set up your DFP Upload by selecting the file field as you did... then go to either your "Insert Record" server behavior or your "Update Record" server behavior (depending on what kind of page it is).

Then double click to open the wizard... if your using DataAssist Insert Record, hit the "next" button in the dialogue box and then you'll see where you can assign values to each column as it corresponds in your database. Highlight the column that will hold your image or file name - you will then see the "value" input box below... you should also see a lightning bolt button which will allow you to set the dynamically generated value of your desire. Hit that button - then expand the WA Upload Files (please note there are two - the first one is global status - the second one, which is the one you want to expand, will have your input's id in parentheses behind it - that's the one you want). After you expand it, select "Server File Name" and then click OK to add that value to your column in the database.

Hope that helps,

Brian

Sign in to reply to this post

roger391472

Hi Brian,

Thanks for getting back to me. I don't have DataAssist, is there a way to do it without it?

Thanks,

Roger

Sign in to reply to this post

martin389853

Hey Roger,

php fries your brian no matter your age. I like to think of it as a 3-d sudoku for nutters! haha.

If you don't have DataAssist (I'm assuming that is an extension for database handling) then you must have set up your database yourself. Are you using phpmyAdmin or are you using the Mysql client? I take it you are able to retrieve existing data from the database without any problems?

Sign in to reply to this post

roger391472

Hi Martin,

3D-Sodoku, now that's a good description!

Yes, I'm using phpMyAdmin with MySql. Most of the functionality is done with custom php except where it was just easier to use the Dreamweaver behaviors. I figured buying the Digital File Pro would be well worth the time savings but I've got to get it to store the filename.

In reading some of the forum info before buying it I saw where people were doing it so I thought it had that functionality built-in.

All of the other columns in the form are inserting fine and the images are uploading correctly, so everything else is working good. I'm able to retrieve the data from the database so everything's good there too.

Any suggestions?

Thanks,

Roger

Sign in to reply to this post

martin389853

Hey there,

You cant use that variable name in the value because the variable won't exist until the page has already been sent. You can use the name of the field where the name of the file is being uploaded to create the variable for your mysql to handle. For instance, if the name of the file is being entered into the field 'upload1', then that is the object you want to use.

<?php if(isset($_POST['upload1'])) { $fileName = $_POST['upload1'];} ?>

Put that above your Mysql statement where you have the UPDATE or INSERT query (like at the top of the page if you like) and in the query where you have the list of database colums and their values being entered ensure that the value for your file name equals $fileName.

For example, SET serverFileName='$fileName'

This is how I would do it, but the guys at WA would probably prefer their software was doing it for you and may have another way... good luck.

Sign in to reply to this post

roger391472

Hi Martin,

Thanks for the help. The more I think about it though the more I think I may go ahead and upgrade to the Suite license and then just do it with DataAssist. I could use some of the other extensions anyway so that may be the best route to take.

Thanks again,

Roger

Sign in to reply to this post

Jason ByrnesWebAssist

Roger,

It is rather difficult to accomplish this with out DataAssist, it requires hand editing the Dreamweaver insert record server behavior.

See the following thread for some information:
showthread.php?t=5504

Sign in to reply to this post

roger391472

Hi Jason,

Thanks for the reply. I've decided to go ahead and do the monthly deal. I'm running out of time to get this site done so it'll probably speed things up anyway.

Thanks,

Roger

Sign in to reply to this post

Jason ByrnesWebAssist

You're welcome.


if you haven't seen it already, check the "How to apply Digital File Pro to DataAssist Insert and Update pages" tutorial in the how To section of the Digital File pro Support page:
digital-file-pro/

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