- Server : IBM X3630
- CPU : 2x Intel Quad Core E5620 (8265 point)
- RAM : 16GB DDR3
- Hard Disk : 4x300GB SAS 15k
- Bandwidth : 10 TB Uplink Port
- Speed : 1 x 1000Mbps Full-Duplex
With above features my server's download speed is good. But when i try to upload a file, it is very slow. I tried 2 ways with 10 MB image file.
First way with file_get_contents():
<?php
$link = 'http://www.domain.com/testfile.jpg';
$start = time();
$size = filesize($link);
$file = file_get_contents($link);
$end = time();
$time = $end - $start;
$size = $size / 1048576;
$speed = $size / $time;
echo "Server's speed is: $speed MB/s";
?>
Result is: Server's speed is: 4.8631234169 MB/s and finished after 2-3 seconds. I think it's great for me!
Second way as normal file upload with php:
<?php
if(isset($_FILES['uploadedfile']['tmp_name']))
{
$target_path = "upload/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ".$target_path.basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
?>
<!DOCTYPE html>
<html>
<body>
<form enctype="multipart/form-data" action="" method="POST">
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
This way important for me because of my clients upload files with this way. It should be fast!
Result for this way: Finished uploading in 53 seconds. It is so wretched speed!
I searched on net how increasing upload speed but i couldnt find anything. What should i do?