Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 2
Trades: 0
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
 
 
Register now for full access!
Reply     « Reply to Passing data!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.08300 seconds with 12 queries