Page 1 of 1

Uploading image files online

Posted: Thu Jun 15, 2006 6:18 pm
by BelleAngel
I've written some code to upload image files for a client's website. It all works fine when it's on the local server, and even when I uploaded the whole system to a temporary site online so th client could check it. Once the site was made live (i.e. the client's actual URL) the image won't upload.

The code is exactly the same at all 3 locations (local server, temporary site, and client's live site). I tried to upload the same image (a .jpg) at all 3 locations and it only worked on the local server and temporary site. On the client's site the error "Only .jpg, .jpeg and .gif files are supported" which is an error check that is in my code. File permissions are set to 777. What I don't understand is how the same image cannot be uploaded on the client's site when the code is exactly the same! 8O

Hope someone can help :)

Posted: Thu Jun 15, 2006 6:27 pm
by Chris Corbyn
Let's not post entire threads in red hey ;)

Is allow_uploads on in php.ini?

Posted: Thu Jun 15, 2006 6:27 pm
by blacksnday
I had a similar problem with same error message
but only when I was trying to upload images through FF.

Turned out that I needed to properly form the allowed filetypes since
a few are different between browsers.

Once I changed my allowed types to the below, the problem went away:

Code: Select all

'image/gif','image/pjpeg','image/jpeg','image/jpg','image/x-png','image/png'

This may not be your problem, but it was same problem I had so it's worth checking out.

Posted: Thu Jun 15, 2006 7:14 pm
by BelleAngel
Wow thanks for the quick reply! This is the first time I've ever used a forum, didn't realise how fast it could be :)

Thankyou for the suggestions too, how stupid do I feel, considering it's neither of those things...instead it was the directory where the images were being uploaded to! On the local server and temporary site, I had the directory manually set (for some reason, didn't use globals) so when the code was uploaded to the client's site, of course the file path wasn't changed :? but now it's all good...

Thanks again, and hopefully you won't hold this against me in the future :P

Posted: Thu Jun 15, 2006 7:23 pm
by blacksnday
BelleAngel wrote:Wow thanks for the quick reply! This is the first time I've ever used a forum, didn't realise how fast it could be :)

Thankyou for the suggestions too, how stupid do I feel, considering it's neither of those things...instead it was the directory where the images were being uploaded to! On the local server and temporary site, I had the directory manually set (for some reason, didn't use globals) so when the code was uploaded to the client's site, of course the file path wasn't changed :? but now it's all good...

Thanks again, and hopefully you won't hold this against me in the future :P
Sometimes those kind of problems are the best!
At least I believe you learn the most from it that way :D