Deviatore Posted September 3, 2007 Share Posted September 3, 2007 Hey, I am new to PHP and only now in the beginning.I am making a website related to photoshop, animation and other kinds of tutorials website.The thing is that i want an application in my website by which any person can submit a tutorial. You can visit my website here once but i have just started to make it: www.pixelspedia.com (Please refresh it once if u cant see it) I want something like this: http://www.pixel2life.com/publish/write/ Please if someone can help me then I am ready to return him the same as much as I can. Quote Link to comment https://forums.phpfreaks.com/topic/67741-writing-and-submitting-to-a-website/ Share on other sites More sharing options...
vijayfreaks Posted September 3, 2007 Share Posted September 3, 2007 Hi.. for tutorial uploder you can use FCKEditor for content write.. and before publishiing it.. it would be inactive status after approved via admin.. public will be access it.. Regards, Vijay Quote Link to comment https://forums.phpfreaks.com/topic/67741-writing-and-submitting-to-a-website/#findComment-340317 Share on other sites More sharing options...
richardw Posted September 3, 2007 Share Posted September 3, 2007 Here is a sample file to upload a tutorial in say "PDF" format. This example assumes there is a Maximum file size. It then inserts the filename and title into a Database and uploads the file to a directory of your choice (make sure permissions are set for writing). The database will allow you to easily list your files. It is a good idea to follow the advice on the previous post not to make the file active by adding another field for approval (i.e. approved with values of 0 or 1 ) with the default being inactive. There is probably more here than you need, but it is a way of uploading an existing file. <?php if ($submit) { foreach($HTTP_POST_FILES as $value) { foreach($value as $k => $v) { echo $k.' => '.$v.'<br>'; } } ?> <?php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES if($HTTP_POST_FILES['userfile']['name'] == '') { echo 'You did not select a file to upload'; } elseif($HTTP_POST_FILES['userfile']['size'] == 0) { echo 'There appears to be a problem with the file your are uploading'; } elseif($HTTP_POST_FILES['userfile']['size'] > $MAX_FILE_SIZE) { echo 'The file you selected is too large'; } elseif(!filesize($HTTP_POST_FILES['userfile']['tmp_name'])) { echo 'The file you selected is not a valid file type'; } else { $uploaddir = '/usr/local/www/vhosts/Your_PATH_HERE/docs/'; // remember the trailing slash! $uploadfile = $uploaddir. $HTTP_POST_FILES['userfile']['name']; if(move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $uploadfile)) { echo 'Upload file success!'; } else { echo 'There was a problem uploading your file.<br>'; print_r($HTTP_POST_FILES); } } ?> <?php $db = mysql_connect("localhost", "YourUsername", "PASSWORD") or die("Could not connect"); $provridb = mysql_select_db("YOUR_DB_NAME",$db); $name = $HTTP_POST_FILES['userfile']['name']; $sql = "INSERT INTO tutorial ( title,filename,category, ) VALUES ('$title','$name','$category')"; $result = mysql_query($sql); echo "Thank you! Your file was posted \n"; ?><br><br> <a href="add-doc.php"><span class="caption"><font color="#0033FF">Add Another Document</font></span></a> | <a href="logout2.php"><span class="caption"><font color="#0033FF">LOGOUT</font></span></a> | <a href="#">Go to DOC List page</a> (not active yet) <br> <?php } else{ // display form ?> <form enctype="multipart/form-data" name="docs" method="post" action="add-doc.php"> <input type="hidden" name="category" value="env_doc"> <span class="caption">Please provide the following information</span>:<br> <hr size="=0" color="#CCCCCC" width="200" align="left"> <br> <br> File Title: <input name="title" type="Text" size="62"> <br> <br> <input type="hidden" name="MAX_FILE_SIZE" value="900000"> Upload this file: <input name="userfile" size="50" type="file"> <BR> <br> <br> <input type="Submit" name="submit" value="Submit File"> <input type="reset" name="Clear" value="Clear"> <br> </p> </form> </p> <?php } // end if ?> Quote Link to comment https://forums.phpfreaks.com/topic/67741-writing-and-submitting-to-a-website/#findComment-340393 Share on other sites More sharing options...
Deviatore Posted September 3, 2007 Author Share Posted September 3, 2007 The whole thing is very simple. Just the need is that i want to provide the user features like bolding the text, adding images, just like when u post something here, u have smilies, font change etc. and at last when it has to be published, it gets published in some format. Quote Link to comment https://forums.phpfreaks.com/topic/67741-writing-and-submitting-to-a-website/#findComment-340490 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.