zenny Posted November 28, 2006 Share Posted November 28, 2006 hi guys, i have created a simple php download manager. which i aim to use it for people to upload file to a certain folder called addon. It works on my apache svr, however when i uploaded it to my webhost it did not work out anymore.. below is my code.. uploaded to my website.<?phpdefine ("FILEDIRECTORY", "/addon");$MaxSize = 5000;$noFilename = "";$getFilename = $_REQUEST['name'];//check if it is posted by the form, and name field is entered if (is_uploaded_file($_FILES['addon']['tmp_name'])) { if($_FILES['addon']['size'] > $MaxSize) { //check max file size echo "<p> Max File Size Exceeded 5mb, please try again or contact [email protected].</p>"; } else if ($getFilename == $noFilename) { //check that filename is entered echo "<p>Please enter a File name for upload</p>"; } else if ($_FILES['addon']['type'] != "application/x-zip-compressed") { //check that the correct format is entered echo "Please zip up your file with WinZip"; } else { $name = $_POST['name']; //upload zip file. $result = move_uploaded_file($_FILES['addon']['tmp_name'], FILEDIRECTORY."/$name.zip"); $desc = $_REQUEST['Discribe']; //opening text file to write and save discription. $resource = fopen(FILEDIRECTORY."/$name.txt", "wt"); fwrite($resource, $desc, "15000"); fclose($resource); if ($result == 1) { //display uploaded item. $uploadDESC = fopen(FILEDIRECTORY."/$name.txt", "r"); $theData = fread($uploadDESC, "15000"); fclose($uploadDESC); echo "<p> File Uploaded Successfully.</p>"; echo "<p> You have uploaded $name.zip with the description below : </p>"; echo "<p> $theData </p>"; } else echo "<p> There was a problem, during uploading process.</p>"; } #endIF }#endIF?> Link to comment https://forums.phpfreaks.com/topic/28725-download-manager-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.