1

Thanks for reading this.

Ok here's my situation.

I have a website that let users upload a picture. I want to keep it kinda dumb proof so i tought that users could upload images right from ther digital camera. The problem is that my host have php set to accept a maximum of 2MB file upload. and a picture right out of a Digital Camera is doing about 10MB. How do i get these Jpeg images to shrink in size before getting on the server without making it to complicated for the users??

Could i treat the files with javascript on client side before it is uploaded? Or is there a really user friendly way of getting it done by the client??

Ideas and solutions are welcome. Thanks.

4 Answers 4

1

You could try using an upload library like http://www.uploadify.com/ or http://swfupload.org/ that use Flash to upload files, which may circumvent the servers upload limit, but if those don't work, you might be stuck.

Sign up to request clarification or add additional context in comments.

Comments

0

.htaccess would be your best solution, especially if you don't have access to PHP.ini. JS won't do what you want, however, Flash or Java applets could (in theory).

Here is the code required in a .htaccess file:

php_value post_max_size 10M
php_value upload_max_filesize 10M

1 Comment

This is the only correct answer. Unless the server resources are increased, the file will not get uploaded.
0

You can't shrink it on the client's computer with PHP. In fact, PHP can't directly interact with the client machine (though it can generate JavaScript, which can).

PHP can not determine the filesize until it has been uploaded.

You may want to look at the Flash backed alternatives, which have greater privileges to this sort of information.

Comments

0

PHP resize image can be used in the server side.

http://php.net/manual/en/function.imagecopyresampled.php

http://www.php.net/manual/en/function.imagecopyresized.php

2 Comments

This doesn't solve the problem of the images being too large to reach the server without hitting the upload limit.
:-( yea after posting only i notice that . no way to delete the post too!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.