Results 1 to 6 of 6

Thread: HTML input type=file, pre-insert data.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2004
    Location
    Earth 4 now.
    Posts
    27

    HTML input type=file, pre-insert data.

    I want to put an initial file name, into an input type=file.

    I'm using this as a substitute..

    <TR><TD>Extra Document:&nbsp;<%=rsAccount("ExtraDocument")%></TD></TR><TR><TD><INPUT TYPE=FILE NAME=extradocument SIZE=43 ></TD></TR>

    (show the initial filename before the input type=file)

    This would be the solution if it worked (But it doesn't seem to work with this type):

    <TR><TD>Extra Document:&nbsp;</TD></TR><TR><TD><INPUT TYPE=FILE NAME=extradocument value=<%=rsAccount("ExtraDocument")%> SIZE=43 ></TD></TR>

    When updating some information, I want to show the old date in the input type=file and make it possible for the user to change it than save it. I can do all that except the part of putting the old date into the input type=file.

    "INPUT TYPE=FILE -> Creates a file select control. User agents may use the value of the value attribute as the initial file name."

    I'm using Internet Explorer... shouldn't the value thing work? Hmm...

    Please help me out, I'm lost.
    Last edited by ShotokanTuning; Jul 15th, 2004 at 05:59 AM.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It's disabled in all browsers I know for security reasons. If it wasn't, I could do the following:
    Code:
    <form id="stealingform" action="mafia.php" method="post" encoding="encoding/mime-multipart">
    <!-- can't remember the exact required encoding for files -->
    <input type="file" name="thief" value="c:\windows\whatever.dat">
    </form>
    <script type="text/javascript">
    window.onload = function() {
      document.getElementById('stealingform').submit();
    }
    </script>
    This would automatically upload your c:\windows\whatever.dat to my server if you visit the page with enabled JavaScript. Hmm, not good.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2004
    Location
    Earth 4 now.
    Posts
    27
    Yeah so basicly it's a no no?

    Could I write a value into it by using Javascript or whatever?

    It's silly if the users have to select the file in every update they do.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It's a big no. Not possible to write anything with JavaScript either, for the same reason.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2004
    Location
    Earth 4 now.
    Posts
    27
    So what I do now is:

    - Write the text: Extra Document.

    - Insert to old path towards the file

    - Put the input type=file there to allow the user to browse for a file.


    So what the user has to choose from is:
    - Copy paste the old file path (when keeping the old)
    - Leave it blank (when no more file)
    - Or change the file path with a new (when setting a new).


    Any thought on making this a bit more user friendly? The copy paste thing is my solution on not being able to set a default value...

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Well, you could make a button "remove current file" and let a blank field mean "no change".
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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