How do I browse for an image to upload ?

Results 1 to 2 of 2

Thread: How do I browse for an image to upload ?

  1. #1
    Join Date
    Dec 1969
    Posts
    105

    Default How do I browse for an image to upload ?

    I&#039m currently trying to upload an image as part of a form - which works fine. However using the standard &#039input type=file&#039 this only gives the filename browse. I need to the user to be able to pick an image to upload by being able to view the image, not just the filename. I&#039ve been experimenting with using an iframe and setting it to display the image file - however of course this doesn&#039t work as the value of the input field isn&#039t set until the form is submitted - can anyone help ?

  2. #2
    tabby Guest

    Default RE: How do I browse for an image to upload ?

    Is this the kind of thing you mean?<BR><BR><BR>&#060;FORM ENCTYPE="multipart/form-data"<BR>ACTION="pageyouwannaseetheimage.asp" METHOD=POST name=form1&#062;<BR>&#060;INPUT NAME="picture" TYPE=FILE ACCEPT="image/*"&#062;<BR>&#060;INPUT TYPE=SUBMIT VALUE="Submit Me!" name=SUBMIT1&#062;<BR>&#060;/FORM&#062;<BR><BR>and on "pageyouwannaseetheimage.asp"<BR><BR>&#060;%@ Language=VBScript %&#062;<BR><BR>&#060;%<BR>FormSize = Request.TotalBytes<BR>FormData = Request.BinaryRead( FormSize )<BR>bnCRLF = chrB( 13 ) & chrB( 10 )<BR>Divider = LEFTB( FormData, INSTRB( FormData, bnCRLF ) - 1 )<BR>DataStart = INSTRB( FormData, bnCRLF & bnCRLF ) + 4 <BR>DataEnd = INSTRB( DataStart + 1, FormData, divider ) - DataStart<BR>Response.ContentType = "image/gif"<BR>Response.BinaryWrite MIDB( FormData, DataStart, DataEnd )<BR>%&#062;<BR><BR>For more info see ASP 2.0 Unleashed. I hope that this is what you meant!<BR>Unfortunatly, using this method you can&#039t submit the other stuff on the form at the same time. <BR><BR>tabby<BR><BR>

Posting Permissions

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