I need a help to upload mp3 and flv uploading codes can any one help me on this

There is a nice tizag tutorial I would suggest following. Basically all you need to do is set a html form which will post files to the server. Then after uploading the server can validate. That is after uploading the server validates as many people get confused with this. And when the file is uploaded, the location of the file can be recorded into a mysql database for later access. Enjoy the tutorial.

There is a nice tizag tutorial I would suggest following. Basically all you need to do is set a html form which will post files to the server. Then after uploading the server can validate. That is after uploading the server validates as many people get confused with this. And when the file is uploaded, the location of the file can be recorded into a mysql database for later access. Enjoy the tutorial.

i tried this and this didn't allow to upload mp3 and flv files

Can any one modify this code for my work

Form

<form enctype="multipart/form-data" action="uploader.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>

php file

<?php
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>

Try the following:

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
<?php
ini_set('upload_max_filesize','1000M');
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>

Try the following:

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
<?php
ini_set('upload_max_filesize','1000M');
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>

thank you for the helping but it doesn't upload flv files

thank you for the helping but it doesn't upload flv files

Could you please describe in detail what happens when you try to upload. Are their any error messages and if so what messages are shown.

Could you please describe in detail what happens when you try to upload. Are their any error messages and if so what messages are shown.

ok this is the error

Sorry, there was a problem uploading your file.

file size is not the matter i think its file type

That error again, grr. I have read about it and if the file begins with a crc32 hash (I think) then php will end up just dumping an error. Although I have experienced this error myself it doesn't seem to be very common. I think the solution would be to replace the move_uploaded_file() with a custom function and also I would suggest trying the following to see if you get any other error messages too...

<?php
ini_set('upload_max_filesize','1000M');
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target);
?>

That error again, grr. I have read about it and if the file begins with a crc32 hash (I think) then php will end up just dumping an error. Although I have experienced this error myself it doesn't seem to be very common. I think the solution would be to replace the move_uploaded_file() with a custom function and also I would suggest trying the following to see if you get any other error messages too...

<?php
ini_set('upload_max_filesize','1000M');
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target);
?>

it is nor workin sorry.....

it is nor workin sorry.....

I know it's not working but did that bring up new errors. Also you may want to look into the copy() function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.