Hey all , I am working on a website on which the user has to upload images, most of the images are of large size and that takes a lot of time for the image to be uploaded, is there a way by which i can reduce the time taken by images to get uploaded, i can compromise a little with the quality.

Following is the code that i am using for uploading images!

Some urgent help would be really appretiated!

$uploaddir = './uploads/'; 
$file = $uploaddir . basename($_FILES['uploadfile']['name']); 

if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { 
  echo "success"; 
} else {
    echo "error";

Edited by Dani: Not a fully working code snippet

5 Years
Discussion Span
Last Post by pritaeas

For one you have no system in place to make sure the image is actually an image and not a server virus.
So the first thing i would do is make that. ANd then work on the image resizing or optimizing. Also even if you have the image resizing
tool, it will still take ages to upload as PHP is a server side script and is processed on the server, So the image would be resized on
the server, not the computer. Even still you can't resize an image with PHP AFAIK, but i do know you need an image resizing servere program that can be executed using PHP.


I think you should search for a Javascript solution, so the images get resized BEFORE uploading.

Resizing with PHP solutions, can be found in this forum. This one for example

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.