Page 1 of 1
Recording Center
Posted: Tue Feb 05, 2008 6:50 am
by Aravinthan
Hi guys,
I am trying to do a record center, in other words , a script that will allow visitor to uplaod a file to the websie. Then other ppl can download it to their comp. Anyway of doing that?
Re: Recording Center
Posted: Tue Feb 05, 2008 7:23 am
by aceconcepts
Try using a search engine to look for something like "php file upload".
There are lots of examples.
Re: Recording Center
Posted: Tue Feb 05, 2008 9:31 am
by Kieran Huggins
That was one of the first scripts I was paid to produce! Though I wrote it in Bash a long, long time ago.
It's much easier in PHP.
Re: Recording Center
Posted: Wed Feb 06, 2008 6:07 pm
by Aravinthan
Hi, I found a code to help me upload it:
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
//This is our size condition
if ($uploaded_size > 350000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
if (!($uploaded_type=="file/age3yrec")) {
echo "You may only upload Age of empries 3 TAD record files.<br>";
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
I dont know what is the file type of the files i want to uplaod.
THe extensions are : .age3yrec
It says file type= AGE3YREC FILE
But i have put FIle, it doenst work, i have put age3yrec it doesnt work either.
Can you please help me?