Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Uploading A File
#1
Ok, im really new to PHP, so this might be a really simple fix...
But what im wanting to do, is have a person upload a file and put their name in a form, that would post to "submit.php" That page would then create a new folder based on their name, and then put the uploaded file into that folder. When I try this code, it just gives me this error:

Warning: mkdir() [function.mkdir]: File exists in /home/vasarine/public_html/apply/submit.php on line 17

and puts the uploaded file into the "demos" folder

Code:
<?php
$name=$_GET['name'];
$email=$_GET['email'];
$uploadedfile=$_GET['uploadedfile'];
$url=$_GET['url'];
$target_path = "demos/";
$address="apply@vasarinet.com";

if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  }
else
  {
  mkdir("/home/vasarine/public_html/apply/demos/" . $name . "/");
  move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],"/home/vasarine/public_html/apply/demos/" . $name . "/" . $_FILES["uploadedfile"]["name"]);
  }
?>

Any ideas?
O, and btw, I know the $target_path isnt used anywhere. Its just something I forgot to take out
Reply


Messages In This Thread
Uploading A File - by Austneal - 03-18-2010, 09:41 PM
RE: Uploading A File - by Cida - 03-19-2010, 12:23 AM
RE: Uploading A File - by Austneal - 03-19-2010, 06:36 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)