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

No File Chosen... update over writes the field value

Thread began 6/18/2012 4:42 pm by ncardoso429882 | Last modified 12/11/2017 8:31 pm by Ray Borduin | 3818 views | 9 replies |

ncardoso429882

No File Chosen... update over writes the field value

Hi all,

I have an update page that also uploads an image. When I call up the page I assign the current field values on the db to each input. My problem is an input type file. It doesn't seem to show the value from my recordset like all the other inputs. If I browse for a new file it works great but if I just hit save it over-writes what I had in the first place.

My preference would be... if the user doesn't browse for a new file, leave the current one alone.

Thanks a million
Nelson

Sign in to reply to this post

Jason ByrnesWebAssist

add a hidden form element to your page, set the initial value of the hidden form element to use the image column from your recordset.

in the upload file behavior, bind the default file setting to the hidden element.

Sign in to reply to this post

ncardoso429882

Quick response as usual...

Thanks so much, but what if they browse for a new file, then I'd want them to update that new file name and not the one in the hidden element. Or am I seeing this wrong?

Sign in to reply to this post

Jason ByrnesWebAssist

the default file setting is only used if no file is uploaded.

if you upload a new file, it will use the new files name.

If you don't, it will use the default file setting for the file name.

Sign in to reply to this post

ncardoso429882

Thanks for all the help

I will try this, I get it now. Thanks again

Sign in to reply to this post

Vikingbear

In more detail please :)

Originally Said By: Jason Byrnes
  add a hidden form element to your page, set the initial value of the hidden form element to use the image column from your recordset.

in the upload file behavior, bind the default file setting to the hidden element.  


I too have an UPDATE form with several FILE FIELDS..
I tried adding a 'hidden' field, but in my case it stays hidden, so I am unable to see what file was uploaded originally and therefore I do not know if I need to upload a replacement file or leave the original..
<span>
<input type="hidden" value="<?php echo $row_WADAsliders['background']; ?>">
<input name="background" type="file" id="background" size="19" tabindex="3">
</span>
Not a skilled programmer, so I am relying on the program to create the code for me I guess...

Any suggestions are greatly appreciated

Sign in to reply to this post

Vikingbear

I may have the answer..

This post has been deleted.

Jason ByrnesWebAssist

if you want to show the file name on the page, you can add it next to the hidden field:
<input type="hidden" value="<?php echo $row_WADAsliders['background']; ?>"><?php echo $row_WADAsliders['background']; ?>

or you could even display the image by adding a img tag:
<input type="hidden" value="<?php echo $row_WADAsliders['background']; ?>"><br />
<img src="path/to/images/<?php echo $row_WADAsliders['background']; ?>" width="200" height="200" />

Sign in to reply to this post

Vikingbear

Solution:

Brilliant.. just what I needed.. Much appreciated..

Sign in to reply to this post

DeanCollins

This post has been deleted.

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