Question about Uploading Images to Web

S

squid

Guest
We have written a shopping cart script in php and have had major success with it, save one thing. Our Mac users have been unable to upload images to web servers, PCs are fine, and i cant figure out whats wrong. We have tried several different browsers for the mac and several different image types. Below is the code that is used to upload the images.

$date = date ("y-m-d-H:i:s");
$hash = md5 ($date);
$product_id = substr ($hash, 0, 6);

if ($_FILES [small_image][size] > 0)
{
if ($_FILES [small_image][type] == "image/pjpeg")
{
$file_extention = ".jpg";
}
elseif ($_FILES [small_image][type] == "image/gif")
{
$file_extention = ".gif";
}
else
{
$error++;
}
// create file name
$image_file_name = $product_id.$file_extention;

if (!copy ($_FILES [small_image][tmp_name], SMALL_IMAGE.$image_file_name))
{
$error++;
}
}

Just wondering if anyone had any clue at all as to why this will not work on a mac. If any would like to test it out I have set up a test site...

http://gs2.lacefarms.com/admin/?page=add_products

Am working on v2 but need to nip this problem in the bud.

TIA

Squid
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Dont know anything about php but is that second if statement supposed to be "image/pjpeg" ? Is that p supposed to be there?
 
OP
S

squid

Guest
yes it is that is the underlying format even though the extension is .jpg There is also just a jpeg format, but i tried that too and everything seems to work on a PC, but not on a MAC. I did have 1 customer who could upload the .gif files but not the jpg's
 
Joined
Jan 15, 2003
Messages
4
Reaction score
16
Points
3
Location
Whangarei, New Zealand
Your Mac's Specs
Pwnt
Perhaps you could print out different error messages for each step so you know exactly where the problem occurs?
 
OP
S

squid

Guest
As I am not a Mac user, i have no way of telling what the errors are, but if someone would like to check it out for me, i will put "echo" statements in the script to show the proccess. Use the link above and i welcome all screenshots of errors, but could you please convert them to jpg format as bmp is to large to transfer.
 
Joined
Jan 15, 2003
Messages
4
Reaction score
16
Points
3
Location
Whangarei, New Zealand
Your Mac's Specs
Pwnt
I meant different php echo statements for the different types of errors you get. But otherwise, no I don't know what's wrong with it. You could try posting a message to the apple web-dev mailing list: http://lists.apple.com/mailman/listinfo/web-dev
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top