Forums

ASP

This topic is locked

enctype="multipart/form-data"

Posted 19 Dec 2006 21:37:21
1
has voted
19 Dec 2006 21:37:21 Franz Jäger posted:
I have a problem with the enctype="multipart/form-data" tag. When i use it than can work with the file data.
I can not work with the Form Data, i become non data. When i use it non then can work with the Form data and
not wit the file data. Were can i help it, it want work with asp this problem.

File one EDIT.ASP
<%@ LANGUAGE="VBSCRIPT"%>
<html>
<head>
<title>Neuer Datensatz</title>
</head>
<body bgcolor="#000099" color="#FFFFFF" text="#FFFFFF">
<form action="save.asp" method="post" enctype="multipart/form-data" id ="formedit" name="formedit">
<table>
<tr>
<td>Datei</td>
<td><input type=file size=50 name="datei" accept="text/*"></td>
</tr>
</form>
<form action="save.asp" method="post" id ="formeditdata" name="formeditdata">
<tr>
<td>Originaltitel</td>
<td><input type="text" name="originaltitel" size="100" value></td>
</tr>
<tr>
<td>Genre</td>
<td><input type="text" name="genre" size="30" value></td>
</tr>
</table>
<input type="submit" value="Add Datensatz" id="submitedit" name="submitedit">
</form>
</body>
</html>


File two SAVE.ASP
<%@ LANGUAGE="VBSCRIPT" %>
<% Response.Buffer = TRUE %>
<HTML>
<HEAD>
<TITLE>Datensatz speichern</TITLE>
</HEAD>
<BODY>
<%
dim path
if request.form("FilePath".count = 0 then
Response.Redirect("edit.asp"
else
path = Request.Form("FilePath" & Request.Form("FileName"
path = path & Request.Form("FileExtention"
end if
%>
<br>
<br>
<%
Response.Write (Request.Form("FileName")
%>
<br>
<%
Response.Write (Request.Form("originaltitel")
%>
<br>
<%
Response.Write (Request.Form("genre")
%>
<br>
<%
Response.Write (path)
%>
<br>
<br>
Originaltitel '<%=Request.Form("originaltitel"%>'
has been added to the database.<br>
</BODY>
</HTML>


Replies

Replied 19 Dec 2006 23:27:07
19 Dec 2006 23:27:07 Lee Diggins replied:
Hi Franz

Your options are split the file upload and other form items into two pages and process seperately or get a file upload component. You can get a free upload class by searching for upload components and following the instructions for accessing form items and handling the file upload.

Using multipart/form-data the ASP request.form does not understand this type, you can view the contents of the form using this script but it won't do you much good:

<%
n = Request.TotalBytes
data = Request.BinaryRead(n)
For i = 1 to n
Response.Write MidB( data, i, 1 )
Next
%>

Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>

Reply to this topic