devilslabphp / phpshop

Automatically exported from code.google.com/p/phpshop
0 stars 0 forks source link

Pictures can not be uploaded #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run phpshop on standard xampp on windows
2. try to upload or update a picture of a product or upload a vendor picture

What is the expected output? What do you see instead?
When updating a picture, the errormessage "Warning:
unlink(C:/xampp/htdocs/www/phpshop/images/shop/product/8716aefc3b0dce8870360604e
6eb8744.jpg)
[function.unlink]: Permission denied in
C:\xampp\htdocs\www\phpshop\WEB-INF\modules\admin\lib\ps_main.inc(222) :
eval()'d code on line 1" is given from PHP in top of the page and the error
message on the page says "An error has ocurred.
ERROR: Image Update command failed.
$ret =
unlink("C:/xampp/htdocs/www/phpshop/images/shop/product/8716aefc3b0dce8870360604
e6eb8744.jpg")"
is displayed on the website. 

When trying to upload a picture of a new product the error message
"Warning: copy(C: mpp mp\php3E.tmp) [function.copy]: failed to open stream:
Invalid argument in
C:\xampp\htdocs\www\gametown\phpshop\phpshop\WEB-INF\modules\admin\lib\ps_main.i
nc(222)
: eval()'d code on line 1" is given from PHP at the top of the page. The
error message given on the page is "An error has ocurred.
ERROR: Image Update command failed.
$ret = copy("C:\xampp\tmp\php3E.tmp",
"C:/xampp/htdocs/www/gametown/phpshop/phpshop/images/shop/product/196796decbd536
81024715ac5522780d.jpg")"

What version of the product are you using? On what operating system?
phpshop-0.8.1 on Windows XP Professional Service Pack 3

Please provide any additional information below.
It seems the temporary picture is not created. The slashes seem to also
work on windows, it doesn't require backslashes. If I use the copy command
myself with a file that is existing, it works fine. I didn't figure out yet
where in the code the .tmp picture is created, I guess there should be the
problem?

Original issue reported on code.google.com by markus.o...@gmail.com on 24 Sep 2008 at 1:08

GoogleCodeExporter commented 8 years ago
After a few more hours of evaluation, it seems the error is thrown from the 
eval()
command. The upload itself would work if executed directly. I don't know what 
the
problem with the eval command could be. Also, it's a really basic function of
phpshop, so why am I running in these problems? Is it because I'm using windows?

Original comment by markus.o...@gmail.com on 25 Sep 2008 at 11:17

GoogleCodeExporter commented 8 years ago
Hi Markus,
This looks like you have to chmod 0777 your image directory before you upload 
an image

Original comment by ulis...@gmail.com on 30 Sep 2008 at 2:23

GoogleCodeExporter commented 8 years ago
Hi
On windows, there is nothing like that, is there?
For now, I just execute the commands right away instead of saving them in a 
variable
and then use eval. I still think that windows has something to do with it.

Original comment by markus.o...@gmail.com on 30 Sep 2008 at 2:39

GoogleCodeExporter commented 8 years ago
Hi Markus,
[function.unlink]: Permission denied 
shows, that there must be a permission error
probably xampp does not allow the script to delete files from the image 
directory or
the image itself  

"Warning: copy(C: mpp mp\php3E.tmp) [function.copy]: failed to open stream:
the slashes/backslashes are missing in path strin, so there is no complete path
present, which causes the error message.
Invalid argument in
"Warning: copy(C: mpp mp\php3E.tmp) 

When i ran the shop under windows, in index.php  i defined
define('PS_BASE', 'h:/www/files/');
so there are no backslashes in the path.
If you want to use backslashes this should look like
define('PS_BASE', 'h:\\www\\files\\');
otherwise a single backslash may be interpreted as escape character which would
explain this:
C: mpp mp\php3E.tmp

Original comment by ulis...@gmail.com on 2 Oct 2008 at 7:21

GoogleCodeExporter commented 8 years ago
try to change
  $path$curr_file
with
  $path.$curr_file

(note the dot)in admin/lib/ps_main.inc

work's for me!

Original comment by nandelb...@gmail.com on 18 Nov 2008 at 6:36

GoogleCodeExporter commented 8 years ago
Just marking this as a 1.0 issue.

Original comment by edikon on 16 Feb 2009 at 2:47

GoogleCodeExporter commented 8 years ago
Notice the use of mixed slashes in the error return when this occurs:

ERROR: Image Update command failed.
$ret = copy("C:\xampp\tmp\php3E.tmp",
"C:/xampp/htdocs/www/gametown/phpshop/phpshop/images/shop/product/196796decbd536
81024
715ac5522780d.jpg")"

My solution was to use the php function ereg_replace, replacing the "\" with 
"/" for 
the temporary file's path. This is run locally on a Windows XP system. I have 
no 
idea what occurs on Linux or other systems.

The use of slashes in paths has always been a confounding issue for me. Various 
systems demand use of one or the other. Sone don't car at all. This should have 
been 
made some sort of standard a very long time ago. But I have no historical 
perspective on this.

Original comment by fliger.d...@gmail.com on 23 Feb 2009 at 11:56