Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Upload.php problem


Gallahazzar

Recommended Posts

Posted

Gooday, i hope you can help me out here :)

 

Installed OsCommerce and the catalog part and store works nicely. The admin part do not however. When i try to enter i get this message

 

Fatal error: Cannot re-assign $this in ***********/"admin"/includes/classes/upload.php on line 31

 

Here is a small part of the file with line 31 pointed out...

 

<?php

/*

$Id: upload.php,v 1.2 2003/06/20 00:18:30 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class upload {

var $file, $filename, $destination, $permissions, $extensions, $tmp_filename, $message_location;

 

function upload($file = '', $destination = '', $permissions = '777', $extensions = '') {

$this->set_file($file);

$this->set_destination($destination);

$this->set_permissions($permissions);

$this->set_extensions($extensions);

 

$this->set_output_messages('direct');

 

if (tep_not_null($this->file) && tep_not_null($this->destination)) {

$this->set_output_messages('session');

 

if ( ($this->parse() == true) && ($this->save() == true) ) {

return true;

} else {

// self destruct

$this = null; <------------LINE 31

 

return false;

}

}

}

 

 

 

Anyone? :)

Posted

You only needed to do a search for $this on the forum and you'd have found hundreds, if not thousands, of replies. But here it goes again:

 

php5 compatibility problem

 

admin/includes/classes/upload.php on line 31, edit

 

$this = null;

 

to this:

 

unset($this);

 

Vger

  • 2 weeks later...
Posted

:thumbsup: hey that was a easy fix it worked

thanks for the info all u got to do it open the file in your editor and go to line 31

make the change :D piece fo cake

Posted

Hey vyger,

 

YOu're the man!!!

 

Thanks man! YOu really help me a lot with your savvy!

  • 1 month later...
Posted

I have also had a problem with upload.php despite any changes to $this.

 

I am running IIS 6.0; MySQL 4.1; & PHP 5. So far everything is working great except when I add a new product in categories.php under admin. As soon as I hit preview the page loads blank. So I took a look at categories.php see that under the case 'new_product_preview' it was making a new instance of the upload class and stopped there (line 314 in categories.php). Any ideas? I thought perhaps it was the chmod() function but not so sure now.

 

I did change line 31 from $this=null to unset($this) - no luck.

 

-Bobbo

  • 2 weeks later...
  • 4 weeks later...
Posted

I had same prob after install, (I have wamp server) on pc at home and this is gonna seem strange but I changed $this to $that --- just for the hell of it... lol - and to my HUGE surprise it worked !!!

 

My hosting co helped me with the install of osc 2.2ms2 and everything was fine except for the 1064 error i was getting which is also fine now :)

Rose

The strong survive BUT the best succeed !!

1064 - You have an error in your SQL syntax

  • 3 months later...
Posted
I've got the same problem and can't get it fixt.

If someone knows how :-)

:lol: HE rik had je ook aan mij kunnen vragen Dennis :thumbsup:

  • 1 month later...
Posted

I don't know why I get a blank admin - The upload file was corrected for previous sites and I checked the line and it's fine.

 

php5 compatibility problem

admin/includes/classes/upload.php on line 31, edit

$this = null;

to this:

unset($this);

 

I have

 

// self destruct

unset($this);

return false;

}

 

Do you know of any other reasons that I could be getting a blank admin?

  • 4 weeks later...
Posted
You only needed to do a search for $this on the forum and you'd have found hundreds, if not thousands, of replies. But here it goes again:

 

php5 compatibility problem

 

admin/includes/classes/upload.php on line 31, edit

 

$this = null;

 

to this:

 

unset($this);

 

Vger

 

I've checked this document for that line 31. I can't find it. It's not even in the original install files when I went back and looked. Am I missing something? I'm not sure what version PHP I have, this is what it says when I log into it phpMyAdmin - 2.8.0.4. Could this be my issue? Is there something else you know of to try?

 

For some reason I still get a blank page when I try to hit www.mydomain.com/catalog/admin

 

Any suggestions?

  • 2 weeks later...
Posted

I am having somewhat of a similar problem. I fixed line 31 with the advice i found on the forum but now when I try to upload an image from my website I get this error : (Fatal error: Cannot re-assign $this in /home/makeyour/public_html/osCommerce/catalog/includes/classes/upload.php on line 33) I believe line 33 is the return false part: This problem occured to me while I was uploading products from the admin panel. Any Ideas would be great.

 

if ( ($this->parse() == true) && ($this->save() == true) ) {

return true;

} else {

// self destruct

//$this = null;

 

return false;

}

}

}

 

Thank you for your time.

Jeremy

  • 4 months later...
Posted
I've checked this document for that line 31. I can't find it. It's not even in the original install files when I went back and looked. Am I missing something? I'm not sure what version PHP I have, this is what it says when I log into it phpMyAdmin - 2.8.0.4. Could this be my issue? Is there something else you know of to try?

 

For some reason I still get a blank page when I try to hit www.mydomain.com/catalog/admin

 

Any suggestions?

 

+1

Same problem here...

  • 2 months later...
Posted
+1

Same problem here...

 

i have a blank catalog and a blank website but i can access the admin. i can't find that "$this=null;" anywhere.

*edit* nevermind. got the 2.2 version but still having the problems...

  • 2 months later...
  • 3 months later...
Posted

OK, so I followed the instructions posted here to solve the line 31 problem but now I have....

 

Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/models/rtodd/admin/includes/classes/upload.php:1) in /usr/www/users/models/rtodd/admin/includes/functions/general.php on line 18

 

I also searched the forums and cannot find a fix....anyone else run into this?

 

Thanks

  • 2 months later...
Posted

unset $this;

 

Worx for me, can now view, and administratre my shop... This is definitly one for the code snippet collection, Thanks :)

  • 2 weeks later...
Posted

I edited the "unset $this;" but am still getting the same error:

"Fatal error: Cannot re-assign $this in /home/....admin/includes/classes/upload.php on line 31"

 

Anything else I need to do to be able to access my Admin Panel?

Posted
Hey vyger,

 

YOu're the man!!!

 

Thanks man! YOu really help me a lot with your savvy!

That is an insult.

  • 3 weeks later...
Posted
You only needed to do a search for $this on the forum and you'd have found hundreds, if not thousands, of replies. But here it goes again:

 

php5 compatibility problem

 

admin/includes/classes/upload.php on line 31, edit

 

$this = null;

 

to this:

 

unset($this);

 

Vger

 

Thanks - was wondering what had changed since my hosting company moved me to a new server.....

 

Worked a treat.

Posted
You only needed to do a search for $this on the forum and you'd have found hundreds, if not thousands, of replies. But here it goes again:

 

php5 compatibility problem

 

admin/includes/classes/upload.php on line 31, edit

 

$this = null;

 

to this:

 

unset($this);

 

Vger

 

Really?...

  • 4 weeks later...
Posted

If I'm not mistaken, when you get an error regarding this file, the complete path to the file is output into your browser window.

 

Just follow it.

 

If you can't find it, either your PHP code tells lies, or you're just not looking in the right place....

:blush:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

  • 4 weeks later...
Posted

My administrator also upgraded both mysql and PHP to versions 5. I've done everything in the official manual and this trick to upload.php but i still the following error while uploading images

 

Error Error: File upload not saved.

 

at the top of the screen when I click preview on new product. I did change the new server path in config.php.

Archived

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

×
×
  • Create New...