class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
As of (at least) PHP 5.2, you can no longer convert an object to a string unless it has a __toString method. Converting an object without this method now gives the error: Object of class could not be converted to string in <file> on line <line>
I have PHP 5.2.3 here, but the class works fine. However, if I do the following at the command line, I have the problem:
$ php -r "echo PHP_VERSION; echo new StdClass;"
5.2.3-1ubuntu6
Catchable fatal error: Object of class stdClass could not be converted to string in Command line code on line 1
What are the lines before and after your line 13? Also, which version of the class are you using?Reply
when i use this class in PHP 5.2 then i got error
Object of class upload could not be converted to string in C:\wamp\www\newproject\upload.php on line 13
but the same class run on php 5.0,
please clear me what the problem?????
thx in advance
but i got error only php5.2 not php 5 why??????
thanks in advance
As of (at least) PHP 5.2, you can no longer convert an object to a string unless it has a __toString method. Converting an object without this method now gives the error: Object of class
I have PHP 5.2.3 here, but the class works fine. However, if I do the following at the command line, I have the problem:
What are the lines before and after your line 13? Also, which version of the class are you using?
if ($_POST['action'] == 'local') { $handle = new Upload($_FILES['user_img']); $handle->mime_check = false; $handle->allowed = array("image/bmp", "image/gif", "image/jpeg", "image/png", "image/jpg"); if ($handle->uploaded) { $handle->image_resize = true; $handle->image_ratio = true; $handle->image_y = 106; $handle->image_x = 100; $handle->file_name_body_add = '_'.$current_userid; $handle->Process('./user_image/'); $upload_image_name = $handle->file_dst_name; } if($upload_image_name=='') { //business logic } else { //business logic } }