Results 1 to 3 of 3

Thread: Populate a File Type HTML control from database

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Populate a File Type HTML control from database

    Hello everybody,

    I have a file control in my asp page and on selection of a drop down, I want to fetch records and populate the file path in the file control so that user can see which file has been uploaded and he change the file if necessary. But file control does nothing if I print the data in the value attribute.

    Thanks.

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: Populate a File Type HTML control from database

    For security reasons you cannot set the value of the file input control. Otherwise it could be used maliciously to upload files off a user computer without their knowledge!

    I would suggest you implement a different system. When displaying uploaded images from a database I tend to do the following:

    1. If there hasn't been a image uploaded just display the file input control with the label "Upload a new image".

    2. If there has been an image uploaded display a thumbnail of the image with the label "Current image". Then display a file input control with the label "Change Image" and finally a button that says "Delete Existing Image" which when clicked deletes the current image stored in the database.

    HTH

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  3. #3
    Addicted Member
    Join Date
    Jul 2004
    Location
    Mumbai
    Posts
    236

    Re: Populate a File Type HTML control from database

    yup

    i do agree with dj4uk. if you want to display user which file has been uploaded just use a set of labels or textboxes, so that the user can change if he wishes.
    --Kishore...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width