Jump to content


php upload


1 reply to this topic

#1 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 13 November 2007 - 12:37 PM

i have an upload form and it works fine for me on ie7 vista home. the client i am working with is on xp home and ie7 and also vista home and ie7, but it wont work for him. it wouldnt work from my office on ie6 and xp home either.

i replaced my original code with the code given on the php.net page and im still having the same problems.

does anyone know of any browser settings or network settings that may be effecting whether it works or not as im well and truly stumped here.

directory is chmod to 777.

heres my code if anyone can spot an error that may be messing things up:

<?
include("header.php");


if ($_POST["uploadFile"]) {

$username = $_POST["username"];
$uploaddir = "/home/**********/public_html/**********/".$username."/";
$uploadfile = $uploaddir . basename($_FILES['uploadedfile']['name']);

if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploadfile)) {
	echo "<font color=red>The file ".  basename( $_FILES['uploadedfile']['name']). " has been uploaded for user $username</font><br />";
} else {
	echo "<font color=red>There was an error uploading the file, please try again!</font><br />";
}

}
?>


<h1>Upload File</h1>


<form enctype="multipart/form-data" action="<?$_SERVER['PHP_SELF']?>" method="post">


Select client to upload file for:<br />
<select name="username">
<?
$query = mysql_query("SELECT * FROM ********** ORDER BY username"); 


while ($row = mysql_fetch_row($query)) {


echo "<option>$row[1]</option>";


} 
?>
</select>
<br />
<br />
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload:<br />
<input name="uploadedfile" type="file" />
<br />
<br />
<input type="submit" name="uploadFile" value="Upload File" class="button">


</form>


<?include("footer.php")?>

thanks in advance.

Edited by Stu, 13 November 2007 - 12:43 PM.


#2 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 13 November 2007 - 02:07 PM

nevermind guys, all sorted.

just for future reference and anyone searching...

part of the problem was that in the clients router his multiplexing method was set to LLC-BASED instead of VC-BASED. once we switched that over it was fine. dont ask why that made a difference but it did :P

other part of the problem was that the host had the max file upload size in the php settings set to 2mb - anyone know why its so low, or is this common?

Edited by Stu, 13 November 2007 - 02:08 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users