Results 1 to 3 of 3

Thread: dvst8 with yet another question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    boy, i'm really on a tear here with questions....
    it seems i hit hang ups all the time, and reference manuals don't really have info on getting around annoying problems.. for that you have to talk to experienced programmers... so here I am, pleading for knowledge...
    i only hope i can help others, as much as you guys have helped me..

    anyway, on with the question:

    I tried to build a simple image broswer in ASP, but couldn't get it working because of a silly detail which I can't work around.

    I have a <input type = "file" name = "file1"> field in a form, and I want to make it so that when the user has browsed and located his/her image, the image will be displayed for him on the same page.

    I had made a "View" (which was really a type = "submit" button) button beside the file field, and when the user clicked it, the page resubmitted the form to the same page, except this time displaying the specified image.

    HOWEVER, then the page reloads the file field comes up blank. Sure I could capture it from the form, but you CANNOT do the following:

    Code:
    <input type = "file" name = "file1" value = "<%=Request.form("file1")%>">
    The value will not fill in!!!!! This is by design in HTML spec. You are not allowed to specify the value of a file field.

    See my problem?
    It's no good having this simple image browser, if when the page reloads, the image comes up, but not the path to the file....

    This is very annoying, and I need a work-around!

    tx
    d8

    [Edited by dvst8 on 05-31-2000 at 01:35 PM]

  2. #2
    Guest
    this will allow a user to browse images on their own machine:
    Code:
    <%@ Language=VBScript %>
    <HTML><BODY>
    <%
    dim strLocalImageLocation
    strLocalImageLocation = Trim(Request("ImageFile"))
    %>
    
    <form name="test" method="post" action="ImageBrowser.asp">
    	<input type="file" name="ImageFile" value="">
    	<input type="submit" value="Show Image">
    </form><br>
    <%
    if strLocalImageLocation <> "" then
    %>
    <img src="<%= strLocalImageLocation %>">
    <%
    end if
    %>
    
    </BODY>
    </HTML>

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    thanks for the code pvb. works flawlessly.
    i had come up with something very similar myself...

    But does anyone know of a way to have the following happen:
    When the page is resubmitted to itself (to view the image), I need the file field to be filled in with the path to file... Tough one.

    I really do not think it can be done.

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