jeff5656 Posted May 31, 2008 Share Posted May 31, 2008 I have a directory called schedules which is a subdirectory of the main root (where index.htm is). This script doesn't work when i try to upload a file. I want the file to be uploaded to the schedules subdirectory. It says test.htm has been successfully uploaded, but the file is not there. <?php $uploadLocation = "\schedules"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>MicroPing domain status checker</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div id="caption">UPLOAD FILE</div> <div id="icon"> </div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="fileForm" id="fileForm" enctype="multipart/form-data"> File to upload:<center> <table> <tr><td><input name="upfile" type="file" size="36"></td></tr> <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Upload"></td></tr> </table></center> </form> <?php if (isset($_POST['submitBtn'])){ ?> <div id="caption">RESULT</div> <div id="icon2"> </div> <div id="result"> <table width="100%"> <?php $target_path = $uploadLocation . basename( $_FILES['upfile']['name']); if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) { echo "The file: ". basename( $_FILES['upfile']['name']). " has been uploaded!"; } else{ echo "There was an error uploading the file, please try again!"; } ?> </table> </div> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/108146-solved-problem-uploading/ Share on other sites More sharing options...
jonsjava Posted May 31, 2008 Share Posted May 31, 2008 try changing \schedules to schedules/ edited to change syntax Link to comment https://forums.phpfreaks.com/topic/108146-solved-problem-uploading/#findComment-554339 Share on other sites More sharing options...
jeff5656 Posted May 31, 2008 Author Share Posted May 31, 2008 thanks that solved it! Link to comment https://forums.phpfreaks.com/topic/108146-solved-problem-uploading/#findComment-554351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.