By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,261 Members | 1,688 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,261 IT Pros & Developers. It's quick & easy.

Undefined index: C:\\Apache2.2 in C:\\Apache2.2\\htdocs\\upload_file.php on line 11,

P: 25
i write 2 php files for uploading file ,it is giving error like Undefined index: C:\\Apache2.2 in C:\\Apache2.2\\htdocs\\upload_file.php on line 11,

upload.php
--------------------
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <form action="upload_file.php" method="post"
  4. enctype="multipart/form-data">
  5. <label for="file">Filename:</label>
  6. <input type="file" name="file" id="file" /> 
  7. <br />
  8. <input type="submit" name="submit" value="Submit" />
  9. </form>
  10. </body>
  11. </html>

upload_file.php
---------------------
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if ($_FILES["file"]["error"] > 0)
  3.   {
  4.   echo "Error: " . $_FILES["file"]["error"] . "<br />";
  5.   }
  6. else
  7.   {
  8.   echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  9.   echo "Type: " . $_FILES["file"]["type"] . "<br />";
  10.   echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  11.   echo "Stored in: " . $_FILES["file"]["C:\\Apache2.2"];
  12.   }
  13. ?>
Aug 3 '07 #1
Share this Question
Share on Google+
2 Replies


kovik
Expert 100+
P: 1,044
it is giving error like Undefined index: C:\\Apache2.2 in C:\\Apache2.2\\htdocs\\upload_file.php on line 11,
Expand|Select|Wrap|Line Numbers
  1. echo "Stored in: " . $_FILES["file"]["C:\\Apache2.2"];
I wonder why.... :P

There is no array index named after a folder.
Aug 3 '07 #2

pbmods
Expert 5K+
P: 5,821
Heya, MMR. Welcome to TSDN!

You're probably looking for something like this:
Expand|Select|Wrap|Line Numbers
  1. echo "Stored in: " . dirname($_FILES["file"]["tmp_name"]);
  2.  
Aug 5 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.