User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,605 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,608 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

File Upload Variables

Join Date: May 2008
Posts: 6
Reputation: 2xldesign is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
2xldesign 2xldesign is offline Offline
Newbie Poster

Re: File Upload Variables

  #10  
May 14th, 2008
Excellent! Thank you for the help..... I am getting a blank page on Page 2 though.....

Here is Page 1

  1. <?php session_start();
  2. $_SESSION['userfile'];
  3. ?>
  4. <html>
  5. <body>
  6.  
  7. <form action="page2.php" method="post" enctype="multipart/form-data">
  8. <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
  9. <input name="userfile" type="file" id="userfile">
  10. <input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
  11. </form>
  12.  
  13. </body>
  14. </html>
  15.  
  16. Page 2
  17.  
  18. <?php
  19. session_start();
  20. $_SESSION['userfile'];
  21.  
  22. $uploadDir = 'upload/';
  23. if(isset($_POST['upload']))
  24. {
  25. $fileName = $_FILES['userfile']['name'];
  26. $tmpName = $_FILES['userfile']['tmp_name'];
  27. $fileSize = $_FILES['userfile']['size'];
  28. $fileType = $_FILES['userfile']['type'];
  29. $filePath = $uploadDir . $fileName;
  30. $result = move_uploaded_file($tmpName, $filePath);
  31. if (!$result) {
  32. echo "Error uploading file";
  33. exit;
  34. }
  35. else
  36. {
  37. $_SESSION['uploadedfilepath']=$filePath;
  38. }
  39. $_SESSION['userfile']=$_POST;
  40. ?>
  41. <html>
  42. <body>
  43.  
  44. <form action="insert.php" method="post">
  45. <input type="text" name="first" id="first" />
  46. <input type="submit" name="button" id="button" value="Submit" />
  47. </form>
  48.  
  49. </body>
  50. </html>

Am I missing something simple?

-Scott
Last edited by peter_budo : May 14th, 2008 at 2:58 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
All times are GMT -4. The time now is 12:02 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC