i need help with my upload script..because it is not uploading file to the folder on my website see the whole code below <form action="homework.php" enctype="multipart/form-data" method="post"> Last Name:<br /> <input type="text" name="name" value="" /><br /> Homework:<br /> <input type="file" name="homework" value="" /><br /> <p><input type="submit" name="submit" value="Submit Notes" /></p> </form> <?php # Set a constant define ("FILEREPOSITORY",$_SERVER['parker/recruitment']."/resume"); if (isset($_FILES['homework'])) { if (is_uploaded_file($_FILES['homework']['tmp_name'])) { if ($_FILES['homework']['type'] != "application/msword") { echo "<p>Homework must be uploaded in WORD format.</p>"; } else { /* Format date and create daily directory, if necessary. */ $today = date("m-d-Y"); if (! is_dir(FILEREPOSITORY)) { mkdir(FILEREPOSITORY); } /* Assign name and move uploaded file to final destination. */ $name = $_POST['name']; $result = move_uploaded_file($_FILES['homework']['tmp_name'], FILEREPOSITORY."/"."$name.doc"); /* Provide user with feedback. */ if ($result == 1) echo "<p>File successfully uploaded.</p>"; else echo "<p>There was a problem uploading the homework.</p>"; } } } ?> PHP:
("FILEREPOSITORY",$_SERVER['parker/recruitment'] the code above is just the path to the folder of my website
try putting ur folder name into static $directory = "app/file/subfolder"; where you want to put the file.. just for conformation
I have been able to use another code and is working fine also I was wondering ,if i want to provide a user with a link to its CV in the folder,so that a user can always click on a link to open his current cv ..how can i do that THANKS
im not brilliant at php, but i guess you could use something like this. print "<a href=\"http://www.yourdomain.com/FILEREPOSITORY/" . $HTTP_POST_FILES['homework']['name'] . ".doc" "\">View your file</a>"; Code (markup):