Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$userfile_name not working

Status
Not open for further replies.

xtreemnet

Programmer
Joined
Aug 9, 2003
Messages
88
Location
NZ
Hi

I am new to php. I have a html page to upload a csv file. This page has action set to execute a php page where I am processing the file. I am checking the file name by using $userfile_name php variable which gets me the file name of the file being uploaded. This was working fine. But recently I added few more lines to this php page and now the $userfile_name does not give me the file name. While debugging in NuSphere it says undefined. As far as I remember I have not changed any settings on my machine.

Can somebody help,

Thanks,
 
What values appear in the superglobal array $_FILES?

Accessing the uploaded file information via $_FILES is the preferred way. The variable $userfile_name requires that the PHP runtime configuration directive "register_globals" be set to "on". The data will always be in $_FILES.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Tried to use the following code as per your suggestion:

This is my html code:

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

And this the test.php code:

<html>
<?php
echo $_FILES['userfile']['tmp_name'];
$userfile_name = $_FILES['userfile']['name'];
echo $userfile_name;
?>
</html>

In the debug mode the $_FILES['userfile']['name'] shows "Error Undefined index: userfile".

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top