![]() |
Uploading images works for me but not others
This is pretty stupid, I have an image upload script, it uploads the images and generated thumbnails, FOR ME, but not for other people. this is too strange to describe, please help. :[
By the way it store those images and thumbnails in a database, well the path. |
We'll probably need to see the code before we can help :-)
What do you mean that it works for you but not others? Does it work for anyone? If not, do they get errors? Alan |
Quote:
PHP Code:
|
Come on Orc, give us a clue :-D
I'm guessing that is your thumbnail code? Is that the part that doesn't work for other users? What does happen? Are you displaying errors, and if so, what errors appear? Alan |
Quote:
Oh crap, well they say its an invalid image cause I do a sub string split using substr to see if it equals png, gif, or jpeg, if it does then it generates a thumbnail and stores it to the thumbnail path, with that it uploads the image as an md5 hash with the end of the image type ( png, gif, jpeg ).. Thing is, I removed a portion of the code where it checks to see if it is an image, then it worked, but the thumbnails didnt generate, so a logical explanation is the sub string(substr). I tried PHP Code:
You still have to remember, it only works for me, not others. |
What does $type actually contain after you have uploaded a file? Your substr() starts checking at character 6, and returns 12 characters which I'm guessing won't match much.
If $type just contains the file extension (without the .), then substr($type) would do it. If it contains the full filename, then you could use substr($type, -3) to get the last 3 characters of the filename (likely the extension). Alternativly, use the pathinfo() function on the filename to get the extension: PHP Code:
|
Quote:
Also, its $_FILES['file']['type'], I then take out image/ and use the others. Update: Now it says invalid image for me >.< |
Can you edit your script and put:
PHP Code:
Alan |
Quote:
Update: $var['extension'] doesn't show the image type either. |
Can you just echo it out once for me as a test so I can see exactly what the string contains? Once we know what it contains then we can figure out how to get what you need.
Alan |
Quote:
|
I fixed this problem, it works now, just the substring, went way off and was blank.. It now works for others.
|
If you want to get the file extension, assuming that your file extension sits at the end of the file name, you can use this function, instead of limiting the file extension to 3 characters (see .jpeg files, .ko files for example):
Code:
$extension = strrchr($file_name, '.'); |
Quote:
|
| All times are GMT. The time now is 05:14 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0