Hi everyone!
I created a PHP upload script and it is successful in uploading the files; however, when I try to access the files on my web hosting provider (Yahoo! Small Business), I get a 403 Forbidden error. Is this because of my script or is it something I need to contact Yahoo! Small Business about? Please help!
Below is the script I used...
CODE
<?php
if (array_key_exists('_submit_check', $_POST)) { // If uploaded file exists
$uploadTo = "uploads/"; // Where the file is going to be placed
/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$uploadTo = $uploadTo . basename($_FILES['userfile']['name']);
$_FILES['userfile']['tmp_name'];
}
?><html>
<head>
<title>Upload script</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="post">
<input type="hidden" name="_submit_check" value="1">
<input type="hidden" name="MAX_FILE_SIZE" value="4194304">
File: <input name="userfile" type="file"> <input type="submit" value="Upload">
</form>
<?php
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadTo)) {
?>The file <a href="<?php echo $uploadTo; ?>" target="_top"><strong><?php echo basename($_FILES['userfile']['name']); ?></strong></a> was successfully uploaded.<?php
} elseif (array_key_exists('_submit_check', $_POST) && !move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadTo)) {
?>There was an error uploading the file, please try again!<?php } ?>
</body>
</html>
Thank you for your help! I really do appreciate it.
This post has been edited by gadgetsguru: 31 May, 2008 - 02:10 PM