| 1 |
|
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Embperl Examples - File-Upload</title> |
| 5 |
</head> |
| 6 |
<body background="../images/jazzbkgd.gif"> |
| 7 |
|
| 8 |
<h1>Embperl Examples - File-Upload</h1> |
| 9 |
|
| 10 |
<hr><h3>The file you enter in the following text box will be uploaded to the /tmp directory if you hit the "upload file" button</h3> |
| 11 |
|
| 12 |
|
| 13 |
[$ if !defined $fdat{ImageName} $] |
| 14 |
|
| 15 |
<FORM METHOD="POST" ENCTYPE="multipart/form-data"> |
| 16 |
<INPUT TYPE="FILE" NAME="ImageName"> |
| 17 |
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Upload file"> |
| 18 |
</FORM> |
| 19 |
|
| 20 |
[$else$] |
| 21 |
|
| 22 |
[- |
| 23 |
open FILE, "> /tmp/file.$$"; |
| 24 |
print FILE $buffer while read($fdat{ImageName}, $buffer, 32768); |
| 25 |
close FILE; |
| 26 |
-] |
| 27 |
|
| 28 |
Your file has been saved to [+ "/tmp/file.$$" +]<br> |
| 29 |
|
| 30 |
<FORM METHOD="GET"> |
| 31 |
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Upload new file"> |
| 32 |
</FORM> |
| 33 |
|
| 34 |
|
| 35 |
[$endif$] |
| 36 |
|
| 37 |
<p><hr> |
| 38 |
|
| 39 |
<small>HTML::Embperl (c) 1997-1998 G.Richter</small> |
| 40 |
|
| 41 |
</body> |
| 42 |
</html> |