Page 1 of 1

File Uploading (Suggestions) !?!

Posted: Mon Apr 19, 2010 9:27 am
by xofter2
Hello,

I want to create a php website which supports to upload files by admin, and which supports to attach images about the uploaded file.
I have been reading a lot of tutorials but no one is about what I need.
I'm novice into this, and I hope someone would be able to recommend me some tutorials about what I need.

Here is a site that I like: http://www.lianasims3.net/index.php
I don't want to copy this site, but I would like my site to have a similar system.

Thanks in advance.

Re: Suggestions !?!

Posted: Mon Apr 19, 2010 10:43 am
by greyhoundcode
xofter2 wrote:to upload files by admin, and which supports to attach images about the uploaded file.
Can you clarify what you mean? If you want to facilitate the uploading of (any type of) files then try something as follows:

Code: Select all

<?php
// Test if the file has been received
if ( (isset($_FILES['userfile'])) && ($_FILES['userfile']['error'] == UPLOAD_ERR_OK) )
{
    // OK, now do something with the file
    echo '<p>We have received the file.</p>';
}
elseif ( $_FILES['userfile']['error'] != UPLOAD_ERR_OK )
{
	// There was a problem
	echo 'Woops ... there was an error when dealing with this file.';
}
else
{
    // Display the upload form
?>
	
<!-- It is important to set enctype to multipart! -->
<form method="post" action="testfile.php" enctype="multipart/form-data">
    <input type="file" name="userfile" />
    <input type="submit" value="Upload!" />
</form>

<?php
}
?>

Re: Suggestions !?!

Posted: Mon Apr 19, 2010 2:36 pm
by califdon
You asked for suggestions, mine is that you read our posting rules and change your Subject to describe what you really are asking for. General Subjects like "Suggestions (?)" are generally ignored by most of the people who might be able to help you. An appropriate Subject for your request might be "File uploading."

Re: File Uploading (Suggestions) !?!

Posted: Mon Apr 19, 2010 3:56 pm
by xofter2
I will test it soon, and I will get back if I'll need more indications.
The topic title has been changed to File Uploading.

Thank you.