File upload example

the form variables for a multipart/form-data form submission are very different from standard form variables. Since you will need access to all the raw data in the form, the "name" of the form variables includes all the mime information that is normally parsed out. Thus when you have an input field like <name="action" value="upload">, that is in a multipart form, the name of the form variable is something like this:

-Content-Disposition: form-data; name="action"- (as opposed to -action-).

The value, however, shows up as -upload-.

When inside a [raw][formvariables][/raw] loop, you usually would do something like this:

[raw][showif [url][name][/url]^[url]"action"[/url]][/raw].

Thus you cannot easily access a particular form variable without looping through all of them and looking for the name contained in the [raw][name][/raw] parameter.


Upload an image:<br>
<form method="post" ENCTYPE="multipart/form-data" action="upload.tpl">
<input type="hidden" name="action" value="upload">
Select the file: <input type="file" name="thefile" value=""><br>
Name the file: <input name="thename" value=""><br>
<input type="submit" name="after" value="ok">

[showif [url][name][/url]^[url]"thename"[/url]]

[hideif [thename]=]
Form Variables:<br>
<table border=1>


[showif [url][name][/url]^[url]"theFile"[/url]]
[writefile file=[thename]&secure=F][value][/writefile]

<a href="[thename]">see picture</a>


Top Articles:

WebDNA Modules

A list of the currently available modules...

WebDNA Libraries

A list of available libraries for WebDNA...

Download WebDNA Applications

WebDNA applications...

WebDNA reference

A list of all WebDNA instructions...

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...


BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

Related Readings:

Annoying character on writefile

How do I get rid of or convert the line feed character during a writefile?...

Removing whitespace

How can I remove all whitespace entered by a user from an input box (ie card number)...

Extracting the first sentence out of a block of text

I need to extract the first sentence out of a block of text...

How old am I?

You want to express an age in years given the dob (mm/dd/yyyy) and today's date...

Spaghetti code

How to get rid of very long search strings...

Setting a 30-minute Cookie

Configuring the expires time for a short-term cookie is tricky...