[thelist] Attachments to HTML forms

Liz Lawson lizlawson at charitycards.co.uk
Tue Jul 18 04:29:04 CDT 2000


yes you can, in NN as well (tested IE4, NN4 on pc)

When you write the form tag, it goes

<form name="foo" method="post" action="bar.cgi"
enctype="multipart/form-data">

The form can have all your usual inputs as well as the file ones.

To allow the user to select the file use the <input type="file"
name="thing"> which gives a file brower box.

(There is an attribute for filtering acceptable file types, but it doesn't
actually work *sigh*.)

I found Dreamweaver mucked up the enctype tag...it put it in the input tag
not the form tag (prehaps this is correct: it doesn't work though!)


I've been handling things using PHP, which has stuff built in for this, so
don't know how much of the following is PHP specific....

On form submission, the file is uploaded to a temporary dir with a temporary
filename. To keep it, the script handling that upload has to copy it to
somewhere else, specifying a filename which doesn't have to be the same as
the original. You can't pass it as a hidden variable through a series of
pages as the temporary file is deleted after the action script for the
upload form ends.

PHP also automatically creates variables for the (original) filename, the
size and the mime type. You may have to set these up yourself in other
languages.

Remember, the mime-type is only as reliable as the browser it came
from...and files from a Mac may not have extensions.


Hope this helps: it's what I was up to last week!

Liz

-----Original Message-----
From: rudy limeback <r937 at interlog.com>
To: thelist at lists.evolt.org <thelist at lists.evolt.org>
Date: 18 July 2000 08:36
Subject: Re: [thelist] Attachments to HTML forms


>>Is it possible to attach documents to HTML forms?
>
>
>hi matt
>
>yes
>
>haven't done this myself but i think it only works in internet explorer
>
>  <input type=file    etc.
>
>see http://htmlhelp.com/reference/html40/forms/input.html
>
>you need a cgi program to accept the file
>
>
>rudy.limeback
>r937.com
>evolt.org
>
>
>
>
>---------------------------------------
>For unsubscribe and other options, including
>the Tip Harvester and archive of TheList go to:
>http://lists.evolt.org Workers of the Web, evolt !
>
>






More information about the thelist mailing list