HTML Form with method="POST" and enctype="multipart/form-data" is not working for passing data to the web server.
| From: | prashant | Date: | Wed, 10 Dec 2003 17:20:18 +0000 |
| Subject: | HTML Form with method="POST" and enctype="multipart/form-data" is not working for passing data to the web server. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-172359@lists.php.net to get a copy of this message | ||
Dear Friends
These is my sample code
test1.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<form name="frm1" method="POST" action="test1.php3"
enctype="multipart/form-data">
<input type="text" name=text1 value="">
<input type=file name=file1>
<input type=submit name=btnsubmit value="Submit">
</form>
</BODY>
</HTML>
test1.php3
<html>
<head><title>Test Page</title></head>
<body>
<form>
<?
echo $text1;
echo $file1;
echo $file1_name;
copy($file1,"d:\prashant\$file1");
?>
</form>
</body>
</html>
I am Facing the problem that if i use enctype="multipart/form-data" in form object
then i am unable to retrieve the values passed from .html form.
So if i am using a File Upload control in my form without the enctype attribute,then i get a warning
message
Unable to open '' for reading: No such file or directory in
/home/httpd/html/fai/test1.php3 on line 12
i.e My HTML Form with Post Method and enctype attribute="multipart/form-data" is not
working for passing data to the web server.
The problem can be solved without the enctype attribute in the Form Tag where i can send the Data to
the
Web Server and the values getting retrieved in another Php Page, but what about if i have to upload
a File using the File Upload control <input type=file name=file1> in my HTML Form.
It Fails in this case where i get the warning message.
Can somebody help me in this regard as soon as possible ???
Thanks,
Prashant S Akerkar