3
Contributors
11
Replies
15
Views
7 Years
Discussion Span
Last Post by cwarn23
0

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.

0

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

0

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.";
}
?>
0

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.";
}
?>
0

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

0

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.

0

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

0

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);
?>
0

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.....

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.