[PHP] HTML Form with method=POST and enctype=multipart/form-data is not working for passing data to the web server.

2003-12-10 Thread prashant

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
headtitleTest 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




Re: [PHP] HTML Form with method=POST and enctype=multipart/form-data is not working for passing data to the web server.

2003-12-10 Thread Richard Davey
Hello prashant,

Wednesday, December 10, 2003, 5:20:18 PM, you wrote:

p form name=frm1 method=POST action=test1.php3 enctype=multipart/form-data
p input type=text name=text1 value=
p input type=file name=file1
p input type=submit name=btnsubmit value=Submit
p /form

You should have set the max_file_size here, but it's not included.

input type=hidden name=MAX_FILE_SIZE value=1000

This must come BEFORE the input type=file and remember the value is in
bytes (not KB), so the above will only let you upload a file of
approx. 1KB.

p ?
p echo $text1;
p echo $file1;
p echo $file1_name;
p copy($file1,d:\prashant\$file1);
?

I don't know how your register globals are set, but you *really* ought to
be getting these values from the $_FILES array:

$file1_name = $_FILES['file1']['name']

etc

See Chapter 18 of the PHP manual.

p Unable to open '' for reading: No such file or directory in
p /home/httpd/html/fai/test1.php3 on line 12

Yeah, you can't copy nothing :)

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTML Form with method=POST and enctype=multipart/form-data is not working for passing data to the web server.

2003-12-10 Thread Jason Wong
On Thursday 11 December 2003 01:25, Richard Davey wrote:

 p form name=frm1 method=POST action=test1.php3
 enctype=multipart/form-data p input type=text name=text1 value=
 p input type=file name=file1
 p input type=submit name=btnsubmit value=Submit
 p /form

 You should have set the max_file_size here, but it's not included.

 input type=hidden name=MAX_FILE_SIZE value=1000

Why? (see archives).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Trying to establish voice contact ... please yell into keyboard.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] HTML Form with method=POST and enctype=multipart/form-data is not working for passing data to the web server.

2003-12-10 Thread Richard Davey
Hello Jason,

Thursday, December 11, 2003, 12:29:07 AM, you wrote:

 You should have set the max_file_size here, but it's not included.

JW Why? (see archives).

Because it's good practise, not to mention sensible?

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[2]: [PHP] HTML Form with method=POST and enctype=multipart/form-data is not working for passing data to the web server.

2003-12-10 Thread Jason Wong
On Thursday 11 December 2003 08:41, Richard Davey wrote:

 Thursday, December 11, 2003, 12:29:07 AM, you wrote:
  You should have set the max_file_size here, but it's not included.

 JW Why? (see archives).

 Because it's good practise, not to mention sensible?

Possibly, if and when it is supported by most browsers. But in the context of 
the OP's problem it does nothing to help.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Be cheerful while you are alive.
-- Phathotep, 24th Century B.C.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[4]: [PHP] HTML Form with method=POST and enctype=multipart/form-data is not working for passing data to the web server.

2003-12-10 Thread Richard Davey
Hello Jason,

Thursday, December 11, 2003, 12:52:55 AM, you wrote:

JW Possibly, if and when it is supported by most browsers.

IE and Mozilla recognise and support it, where are these other most
browsers ? It might be an advisory, but it's still good practise.

JW But in the context of the OP's problem it does nothing to help.

As does your reply ;) In the original context, it was only part of my
message.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[4]: [PHP] HTML Form with method=POST and enctype=multipart/form-data is not working for passing data to the web server.

2003-12-10 Thread Jason Wong
On Thursday 11 December 2003 09:10, Richard Davey wrote:

 JW Possibly, if and when it is supported by most browsers.

 IE and Mozilla recognise and support it, where are these other most
 browsers ? It might be an advisory, but it's still good practise.

If you know off-hand which versions of IE and Mozilla supports it please do 
tell.

 JW But in the context of the OP's problem it does nothing to help.

 As does your reply ;) In the original context, it was only part of my
 message.

To make amends, my reply to the OP would be follow the example(s) in the 
manual.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
And do you think (fop that I am) that I could be the Scarlet Pumpernickel?
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php