I got the below from a tutorial and attempted to change the doc root as suggested. I wanted to make sure it was possible before writing my own stuff.
Well, it doesn't work, is this because I'm uploading the file (up_load.php) into cgi-bin where I'm being forced to run my php files from?
If so, is there anything I can do about it, and will the problem be sorted by most other "normal" hosters or is it something I need to ask specifically about?
I know the problem doesnt lie in permission for the tmp directory, to make sure there weren't problems there I chmoded it to 777 (ie all permissions)
<BODY>
<?
if (isset ($users_file)) {
echo "<B>Remote File Name:</B>$users_file<BR>";
echo "<B>Local File Name:</B> $users_file_name<BR>";
echo "<B>Local File Size:</B> $users_file_size<BR>";
if (isset ($users_file_type)) {
echo "<B>Local File Type:</B> $users_file_type<P>";
}
// Change $doc_directory to your 'DocumentRoot'.
$doc_directory = "http://www.site.co.uk/htdocs/";
$my_file = "tmp/uploaded-".$users_file_name;
$copy_path = $doc_directory.$my_file; if ($users_file != "none") {
if(!copy ($users_file, $copy_path)) {
echo "File upload failed!";
}
else {
?>
<A HREF="<? echo $my_file; ?>">Upload Complete!</A> <?
}
}
else {
echo "<P>You must select a file to upload!<P>"; ?>
<A HREF="<? echo $PHP_SELF; ?>"><B>Back</B></A> to the Upload Form
<?
}
} else {
?>
<FORM ACTION="<?
echo $PHP_SELF;
?>"
ENCTYPE="multipart/form-data" METHOD="post">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="20000">
<INPUT TYPE="file" NAME="users_file"><BR> <INPUT TYPE="submit" VALUE="Upload!"> </FORM>
<? } ?>
</BODY>
Thanks anyone