Recording Center

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Recording Center

Post 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?
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Recording Center

Post by aceconcepts »

Try using a search engine to look for something like "php file upload".

There are lots of examples.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Recording Center

Post 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.
Aravinthan
Forum Commoner
Posts: 84
Joined: Mon Jan 28, 2008 6:34 pm

Re: Recording Center

Post 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?
Post Reply