SHARE
Facebook X Pinterest WhatsApp

Form Attachments

Written By
thumbnail
Joe Burns
Joe Burns
Jan 4, 2005

Use these to jump around or read it all…


[Attach Something]    
[The Input tag]


I’m about to do something I’ve never done before. I’m about to write a tutorial dedicated to a command that really…well…doesn’t work, to be honest with you. Some of you may be saying I’ve already done that a few times. Not so–just because you couldn’t get it to work doesn’t mean it doesn’t work for anyone. 😉

That statement above isn’t totally true. This tutorial does work if you set it up correctly, and if the people who are sending you attachments attach the correct types of documents.


You’ve probably picked up by now that I’m going to go over a form element tag that will allow your users to attach files to your forms. The tag has been available for years now, but I’ve never gotten around to writing about it because it has always been a total failure. My latest run around the Web seems to confirm that.

The best I’ve been able to do with the tag is to get text and HTML files to attach to e-mail. By “text,” I mean text. Word documents, spreadsheets, and images seem to get crunched when they come through the mail. Oh, they’ll open, but the file is often damaged and sometimes arrives in a totally different format than it started. For example, if you send a JPG using this, it ends up a QuickTime movie at the other end. Huh.


However, I get a lot of e-mail about it and I actually have gotten it to work in some cases, so why not write a little tutorial to set the record straight? It is my opinion that this command was never really meant to work with a simple mailto: form. The concept of the command was to have a form element that could attach a file to a packet of information being sent to a CGI. No, I haven’t given the CGI side of it much thought.


As a basic form command, it’s limited, but it does offer some help. Maybe you’ll land upon the correct configuration to allow it to safely send files. The best I, along with a lot of other people on Web newsgroups, could do was to get text to send. I actually feel pretty good about that, because some folks couldn’t get anything to go.



Attach Something

Below is a basic form that asks for a name and then an attachment. If you click on the Browse button, you’ll get a familiar dialog box that will allow you to pick an attachment. Choose your attachment and click Open. You’ll see the full path to your chosen file pop up in the box.

Go for it. Just don’t submit the form. It isn’t set up to send right now. I mean it. Don’t click to send the form. I’m serious!




Name:

Attachment:



The Code

Recommended for you...

Guide to International SEO
How to Use the HTML a Tag
Project Management Tools for Web Developers
Enrique Corrales
Jun 20, 2022
Five Essential HTML5 Editors
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.