Jump to content

simple upload script


private_click

Recommended Posts

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

<?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 public view
$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 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.

 

Link to comment
https://forums.phpfreaks.com/topic/119473-simple-upload-script/
Share on other sites

i succesfully uploaded a 1.6Mb .mpg and converted it to .flv using my script.

still, when i try to upload bigger .mpg files (like 48Mb and 50 Mb) it just reload the script so i guess the problem is about the file size.

i also updated the following directives in php.ini:

max_execution_time = 300000     ; Maximum execution time of each script, in seconds
max_input_time = 600000000000000000 ; Maximum amount of time each script may spend parsing request data
memory_limit = 900M      ; Maximum amount of memory a script may consume (8MB)

i guess the values i wrote are big enough.the values are also updated in phpinfo();

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/119473-simple-upload-script/#findComment-615524
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.