Services

How to adapt an upload form

If your site already lets users upload images, it’s easy to get them to edit their images in Snipshot first. You can adapt an existing upload form on your site to send pictures to Snipshot and then have Snipshot send them back to your site. This way, Snipshot can act as a filter for any image coming into your site.

What’s more, Snipshot will relay any non-Snipshot data back to your site. Any descriptions, IDs, names, tags or other text fields that are collected in your form will be passed back with the edited image. However, extra file data will be discarded.

To adapt your form, all you have to do is change the action to point to Snipshot and add two special Snipshot <input> fields. The specific changes can be seen in the following example.

Here is the HTML code for a fictional form at imagehousing.com.

HTML before
<form action="http://www.imagehousing.com/upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="file" size="40"/>
    <input type="text" name="description" size="80"/>
    <input type="submit" value="submit" name="submit"/>
</form>

Now here is the HTML code as it should appear after adapting the form to use Snipshot. Notice how the old <input> fields have not changed.

HTML after
<form action="http://services.snipshot.com/" method="post" enctype="multipart/form-data">
    <input type="hidden" name="snipshot_input" value="file"/>
    <input type="hidden" name="snipshot_callback" value="http://www.imagehousing.com/upload.php"/>    
    <input type="file" name="file" size="40"/>
    <input type="text" name="description" size="80"/>
    <input type="submit" value="submit" name="submit"/>
</form>

Now this form is ready to post images to Snipshot.