Uploading Files to your Web Forms

Published: February 20th, 2013

Very often customers with web site forms would like their users to be able to upload images or other files along with all of the rest of the form data that will be submitted.  These files could be anything, really:

  • Music files
  • Patient X-rays
  • New software
  • Screen shots
  • etc.

Uploading files from a web form is a two-part process.  First, you need to properly configure your form.  Second, you need to properly collect those files on the server.

Configuring your Web Form for File Uploads

In order for your web form to have file uploads, you need to update your <form …> tag with a special parameter that tells the web browser to send the file data along with the rest of the form data.  If you leave this out, the files will not be sent.  Update your

<form name=”form_name” action=”target_url” method=POST>

with

<form name=”form_name” action=”target_url” method=POST enctype=”multipart/form-data”>

E.g. add the new “enctype” parameter and be sure that the “method” is “POST” and not “GET”.

Next, you can put the form fields in your form where you want the file upload boxes to appear:

<input type=file name=file_field1>

This produces a file browsing box that users can click on and select a file from their computer.  If the user does this and the form is submitted, then the file will be sent to the server along with your form data.

Preparing your Server for File Uploads

When the files arrive at your server, you need to be sure that:

  • Your server is configured to accept files … and of the size that you need to accept.  Many servers, especially ones running PHP, will have strict limits on the maximum size of file uploads.
  • Your server software is looking for the uploaded files.

You need to program your form processing software to properly save and handle these files.  Most basic email-to-form software does not handle uploaded files.

Uploaded Files with LuxSci SecureForm

A quick and easy way to be sure that your files are processed is to use LuxSci SecureForm as the back end to collect your form data.  It supports:

  • Up to 25 files uploaded per post
  • Up to 50MB total data uploaded per post

Additionally, it is pre-configured to properly handle the files and deliver them to you automatically in any of these ways:

  • Emailed to you as email attachments (encrypted if needed)
  • Uploaded to your server via FTP or SFTP
  • Saved in our online WebAides file storage area

With SecureForm, you can be receiving files in minutes … as soon as you can make the needed updates to your web form.

 

Leave a Comment


You must be connected or logged in to post a comment. This is to reduce spam comments.

If you have not previously commented, you can connect using existing social media account, or register with a new username and password.