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
#2
That's on Linux right? I don't know much about Linux with PHP, but on Windows, it's "\" not "/", if that's not the problem, then Idk, I'm that that great with PHP.
Reply
#3
It works ok when I dont include the mkdir line, and just put it in the "demos" folder. It starts making problems when I try to create that directory. I might be doing something wrong with creating it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)