hi guys, i have my upload.php, now the problem is that it does not download pdf files, it says that there is a problem with regards to the uploading.

can you help me??? thanks in advance...

8 Years
Discussion Span
Last Post by xuexue

this is the code sir

echo"<form enctype='multipart/form-data' action='fileRecs.php' method='POST'>";
echo "<input type='hidden' name='MAX_FILE_SIZE' value =1000000/>";
echo "Choose a file to upload: <input name='uploadedfile' type='file' /><br />";
echo "<input type='submit' name ='upload2' value='Upload File' /></form>";

$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
$nameFile =  basename( $_FILES['uploadedfile']['name']);

XX - I think we'll need a bit more than that.

Where's the contents of fileRecs.php? That's where your script is breaking down.

Also why all the php stuff at the bottom of the form? Personally I'd just leave the form as vanilla html:

<form enctype='multipart/form-data' action='fileRecs.php' method='post'>
  <input type='hidden' name='MAX_FILE_SIZE' value ='1000000' />
  <label for='uploadedfile'>Choose a file to upload:</label>
  <input name='uploadedfile' type='file' />
  <br /> 
  <input type='submit' name ='upload2' value='Upload File' />

What exactly is the error you're getting. Something about file not existing? If so, your destination is wrong. Perhaps it would help to include your virtual root at the start of your path: $path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/'

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.