Reply
Passing data!
Old 07-07-2004, 07:01 AM Passing data!
Junior Talker

Posts: 2
I have this form in html:

<form enctype="multipart/form-data" action="upload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>

My problem is that I can't access to the variable userfile and I think the problem was because I use enctype="multipart/form-data"

In the file I access the variable userfile the code is below:

<?php

$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";

?>

If I do echo($userfile); in the code above nothing is return!
So I supose that nothing is pass in the userfile variable!

To resolve this problem I use $userfile= $HTTP_POST_VARS["userfile"]; and the enctype as default!

I need to know why doesn't whork with enctype="multipart/form-data"? What I'm doing wrong? It's needed some configuration on php.ini?
Vitor is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Reply     « Reply to Passing data!
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11495 seconds with 12 queries