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

file extension being removed from file name entered into DB

Thread began 1/29/2019 9:34 am by s.joiner74419001 | Last modified 2/04/2019 1:19 pm by Ray Borduin | 64 views | 9 replies |

s.joiner74419001

file extension being removed from file name entered into DB

How can I keep the file extension with the file name that enters the database. I have tried numerous bindings but they all remove the file extension.

heres the code created

<?php
// WA_UploadResult2 Params Start
$WA_UploadResult2_Params = array();
// WA_UploadResult2_1 Start
$WA_UploadResult2_Params["WA_UploadResult2_1"] = array(
'UploadFolder' => "files/".$rsEnquiry->getColumnVal('premises_name') ."/add-notes",
'FileName' => "".((isset($_FILES["files_n"]))? preg_replace('/.[^.]*$/', '', $_FILES["files_n"]["name"]) :"") ."",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult2_1 End
// WA_UploadResult2 Params End
?>

i've attached my page:

Thanks in advance!

Attached Files
enquiry-details.php
Sign in to reply to this post

Ray BorduinWebAssist

Use:
'FileName' => "[FileName]",

That will upload and keep the existing file name with extension.

The database binding should use the "Server File Name" binding that is part of the file upload bindings added by webassist.

Sign in to reply to this post

s.joiner74419001

Hi Ray..

That still removes the file extension...Thats what the setting was originally, before I upgraded DW and Databridge. It was working fine then. Incidentally "[Filename]" is now not an option in the "Upload Files" bindings. I've attached a screen shot of the binding options I now have. These now have a different structure. I've tried numerous bindings but none maintain the file extension.

I'm also testing the Download behaviour which I can’t seem to get working correctly either. Because the upload behaviour is removing the file extension ( .jpg ) I am adding this to the database field manually to test the Download behaviour which at best is downloading a file but re-naming it with just the file extension with no period ( jpg ) but it is only downloading the first entry in the database and not the correct selection from the repeat region. For this I used the “File Name” binding from the “Download File” binding options.

Not sure where I’m going wrong here.

Ive given FTP / DB access, plus a URL with parameter for the page that has the Upload / Download behaviours on.

I am testing the upload behaviour from the form at the bottom right of the page under “Add additional notes and files” section.

The Download behaviour I’m testing is in the “Additional notes and files” section with an Accordion built from a repeat region.

Sign in to reply to this post

Ray BorduinWebAssist

Update your MySQLi Insert server behavior and change the binding for the files_n column. Click the lightning bolt and choose:

Upload Files (files_n) ->{dyn}/[FileName] (2):Server File Name

That should include the full file name on the server including the extension.

Sign in to reply to this post

s.joiner74419001

Ok Thanks Ray..
I still had a but if trouble figuring out what the 'File Binding' should be in the Upload behaviour. The Tutorials for Digital File Pro doesn't explain this at all and appear outdated to the current release of DW. For me this was really unclear as to what I needed to achieve.

eventually I got it working by binding - "Form POST: form_name / field_name / field_name Simple File Name

I am still having problems with the Download behaviour. I can not get the file to download and keep its full file name. As I explained in the previous post.

What settings do I need for this for "File name:" and "Save as:" in the Download Behaviour?.

Thanks in advance.

Sign in to reply to this post

Ray BorduinWebAssist

File Name is the name of the file to download, presumably from a recordset value in your case.

Save as can be left as: [FileName]

That will keep the file name that is being downloaded.

Sign in to reply to this post

s.joiner74419001

This doesn't work for me Ray.

Firstly it saves the file as - [Filename].jpg ... Every time.

Secondly it always downloads the the first file referenced in the DB table and not the one selected from the repeat region.

Sign in to reply to this post

Ray BorduinWebAssist

It is case sensitive... It looks like you used: [Filename] instead of: [FileName]

Sign in to reply to this post

s.joiner74419001

Thanks Ray.. File now downloads with correct file name.. But it is still only downloading the top database entry and not the one selected from the repeat region in the accordion. Any ideas?

Sign in to reply to this post

Ray BorduinWebAssist

It looks like you set the downloaded file to come from a recordset, but that recordset is looped on and has multiple rows. You would probably need to create a second recordset that is filtered by the submitted form, or use the posted form value for the file name instead of the recordset so it knows which file to download. The way it is now it will always be the first row in the recordset you have it bound to.

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