simple upload script
Posted: Wed Aug 13, 2008 7:32 am
hello.
i am having some problems with my upload script and i don't really know what's wrong.
i am running apache2.2 with php 5.2.6 with mysql5 on windows xp.
i am currently working on a youtube clone script.everything works great, except the uploading the file to the server.
i will give u the code for index.php
the thing is it works with .jpg files and mp3 (as i tested) but when i try to upload a .mpg it just refresh the page and it doesn't upload the file.
the limit in php.ini for uploading files is set to 500M, the .mpg is 50M, and in phpinfo() it display that the limit is set to 500M, so i guess no problem there.
pls help.thx.
i am having some problems with my upload script and i don't really know what's wrong.
i am running apache2.2 with php 5.2.6 with mysql5 on windows xp.
i am currently working on a youtube clone script.everything works great, except the uploading the file to the server.
i will give u the code for index.php
Code: Select all
<?php
session_start();
if(!isset($_POST['upload'])) {
echo '
<form name="upload" enctype="multipart/form-data" method="POST" action="'.$_SERVER['REQUEST_URI'].'">
<input type="file" name="file" size="13" value="">
<br /><input type="submit" name="upload" value="Upload">
</form>
';
}
else
{
$yourdomain = 'mydomain.com'; //it's set correctly in script, just removed for devnetwork
$uploaddir = 'upload/raw/';
$filename = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$tmpname_file = $_FILES['file']['tmp_name'];
move_uploaded_file($tmpname_file, "$uploaddir$filename");
echo "Successful.<br /><b>URL: </b><textarea rows='1' cols='13'>".$yourdomain.$uploaddir.$filename."</textarea>";
}
?>
the limit in php.ini for uploading files is set to 500M, the .mpg is 50M, and in phpinfo() it display that the limit is set to 500M, so i guess no problem there.
pls help.thx.