Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Image upload


Undefined

Recommended Posts

We have been running osCommerce for about 6 months now and all of a sudden when you add a new product to our active store, the product image fails to upload. The warning with the pink background appears saying "Warning. No file uploaded" and I have to go in through the database and insert the name of the picture manually and I also have to upload the image via ftp. I right clicked on the url of the blank image and it gave me "http://www.mydomain.com/catalog/images/" with mydomain being my url.

I know I have plenty of HD space on my hosting because I can upload the files via ftp and I checked how much space I had left and it was plenty.

Any help would be gladly appreciated. Thanks.

Link to comment
Share on other sites

Your web host may have changed their configuration so that the temp folder no longer works. The way image uploading works is that the image is first uploaded to PHP's temp folder, then copied to the store folder. In many cases, you can set your own temp folder with a php.ini.

 

Contact your host's support desk and see if they're aware of any changes in this area.

Link to comment
Share on other sites

I doubt that would help. As an experiment, and though I usually recommend removal of this feature, go to the File Manager tool in admin and see if it will successfully upload a new file. (Make sure it is a file that does not exist.) If this works, then the PHP mechanism is probably ok and solving your problem will require some code debugging.

Link to comment
Share on other sites

I did that and everytime a file uploads it says upload successful but the file is empty and says 0 bytes and if the file I use does not even exist, then it still says upload successful and creates a file that is 0 bytes in filesize. There haven't been any changes in my file codes for months. I have a couple of contributions but they have been working fine for the longest time. Is it possible some of the source got corrupted????

Link to comment
Share on other sites

What you have to do is supply a php.ini file, based on what your host provides, and then edit the line that defines the upload temp directory to be what you want. On my store, I made this be a folder local to my site rather than the server-wide /tmp.

 

It's a PHP thing, not an osCommerce thing. You'll have to ask your host how to supply a custom php.ini, or what their default one is. The file just goes in your top-level web directory (where index.php is.)

Link to comment
Share on other sites

I follow you almost... but if my host says that "/var/tmp" is my temp directory why would i need to make an *.ini file. Since my knowledge of php is very little I would rather not go that route. In the mean while I have emailed them on how to supply a custome php.ini file and to tell me what their default one is.

Link to comment
Share on other sites

osC uses a PHP function to upload the file, and it initially gets placed in a directory specified by the PHP setting upload_tmp_dir. This is normally set by your host in the default php.ini to some central place (such as /var/tmp). If you want to change it, you get a copy of the default php.ini, make the changes you want, and upload it to your top level web folder.

 

Now, the problem you may be having is something else entirely, but the symptom you describe suggests that your host broke PHP uploads for all users in their default php.ini. I know this can happen because, at one time, my host did the same.

Link to comment
Share on other sites

I did that and everytime a file uploads it says upload successful but the file is empty and says 0 bytes and if the file I use does not even exist, then it still says upload successful and creates a file that is 0 bytes in filesize. There haven't been any changes in my file codes for months. I have a couple of contributions but they have been working fine for the longest time. Is it possible some of the source got corrupted????

Try to upload a text file with some text in it and check if it still has 0 bytes ?

Link to comment
Share on other sites

Right - /var/tmp was just an example and, in my view, not usually a good choice. Better would be the path to a folder within your own site's area, especially if it's outside the directory that is used for web files.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...