UBB.Dev
Posted By: JustDave [5.5] Upload Userpic (revisited) - 02/06/2002 4:31 AM
I like the idea of allowing members to upload their pictures once I have more drive space available to me so I made some changes to poil's hack for myself.

1. Only allow the picture upload if we are accepting file uploads.

2. Only allow .jpg extentions. (if more than one extention for this it could be more of a mess when deleting user accounts and you wan't to delete their pictures also)

3. The file name is based on their U_Number and not their U_Username values. This is to avoid breaking other hacks such as the "Change Username" last updated by Max Fish I believe.

4. Now checks the picture against the max file size allowed in the config.inc.php file.

I think that about sums things up... I'll work on a hack to delete the picture if you delete the user when I get some time. []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

The file is attached.

~Dave



Attached File
43975-5.5-uploadpic.1.0.txt  (64 downloads)
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/06/2002 4:36 AM
LoL always an after thought. I spose it's no big deal to allow both .gif and .jpg files. One would just have to check to see if either exist if you are deleting the user.
Posted By: AllenAyres Re: [5.5] Upload Userpic (revisited) - 02/06/2002 4:37 AM
Sounds like a nice upgrade Dave []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/06/2002 4:41 AM
Thanks []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/] I modified the scripts on my test board and the picture upload worked and also worked (denied me) when I wanted to upload something other than a .jpg but I haven't tried a max size yet... now I have to find a large picture... lol
Posted By: AllenAyres Re: [5.5] Upload Userpic (revisited) - 02/06/2002 5:02 AM
Would adding .gif be a major hassle? A lot of people use gif as their avatar...
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/06/2002 5:04 AM
nope not at all... actualy working on that right now... LoL
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/06/2002 5:58 AM
Ok this hack allows either .gif or .jpg files to be uploaded. []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

I also went through and tested each format and also the size checks and extention checks. Everthing seems to be working now. []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

The UPGRADED User Pic Upload file is attached to this post.

(my attachment list pal will be handy here []https://www.ubbdev.com/threads/php/images/icons/wink.gif[/] )

Attached File
43983-5.5-uploadpic.1.5.txt  (52 downloads)
Posted By: AllenAyres Re: [5.5] Upload Userpic (revisited) - 02/06/2002 6:17 AM
Grazi []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/] I'll add it here []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

In reply to:



(my attachment list pal will be handy here )




izzat something coming? []https://www.ubbdev.com/threads/php/images/icons/laugh.gif[/]
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/06/2002 6:36 AM
hehe yep... actualy have it working... but I need to allow for paging forward and back. Right now it just displays a list of the last 50 attachments posted... lol should have it out soon though []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]
Posted By: XanthViper Re: [5.5] Upload Userpic (revisited) - 02/06/2002 3:31 PM
Ok..I know I am a pain on this board and truly I try not to be, but this is one hack I really want to add for my users since I get annoyed seeing useless posts just so they can do file attachments and then link the file to their profile with that. Anyway, I just added the code to my pages and it is not coming up with any errors so that is good. However, it will not upload the file.. So I was like ok..maybe it's permissions...I chmodded the files dir to 777. Nope still didn't do it... said hell with it, so I chmoded everything to 777. nope. So I am at a loss now...If this was all ASP and IIS, I wouldn't be bothering you guys as thats what I do daily, but PHP and LINUX is just a bit out of my reach now since I don't work on it on a daily basis.
Posted By: efnguy Re: [5.5] Upload Userpic (revisited) - 02/06/2002 3:48 PM
Same for me. I couldnt get it to upload the user pic. I also am an asp IIS, mcsd, guy so Im a little green with php. The upload function that comes with this system does upload files without any problems but this hack I either dont understand or isnt working.
Posted By: XanthViper Re: [5.5] Upload Userpic (revisited) - 02/06/2002 4:11 PM
Hopefully Dave will have something for us soon []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]
Posted By: just4clicks Re: [5.5] Upload Userpic (revisited) - 02/06/2002 4:49 PM
Hey Xanth...I may be able to help you...got mine working.

Very Cool Site! I'm up here in HB, and I'd love to film some events and digitize them for your site sometime!
Posted By: XanthViper Re: [5.5] Upload Userpic (revisited) - 02/06/2002 5:03 PM
How did you get it to work? perhaps I missed something? As for the site..thanks..I appreciate it...PM me here if you want, no need to go off topic.
Posted By: just4clicks Re: [5.5] Upload Userpic (revisited) - 02/06/2002 5:08 PM
Scratch that "works perfectly" for me ...I got it without any errors, but I have the same prob of the files not uploading either...I'm sure it's something simple, and Dave is very good with responses (He's helped me out tons already).
Posted By: ExcelsiorDDZ Re: [5.5] Upload Userpic (revisited) - 02/06/2002 9:15 PM
the avatar directory is capital sensitive! S name it Avatars, not avatars.


I have found that some GIF files are not liked by this at all, especially if they have to be compressed froma larger size.
Posted By: just4clicks Re: [5.5] Upload Userpic (revisited) - 02/06/2002 9:41 PM
I thought it used the "files" directory from the attachments???
Posted By: XanthViper Re: [5.5] Upload Userpic (revisited) - 02/06/2002 9:42 PM
Nothing in this scripts uses Avatars. Uses the config file attachment folder.
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/08/2002 6:01 AM
Right... I decided to use the same file as the attachments to limit the work needed to be done for this hack. I wonder if I failed to mention changing the form to the mozila one for file upload? I'll take a look and get right back to this. []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/08/2002 6:10 AM
Ok I forgot to mention an important part of this hack... changing the form. LoL in your editbasic.php script at around line 119? you should see this line:

<form method = POST action = "{$config['phpurl']}/changebasic.php">

Change that to this:

<form method = POST enctype='multipart/form-data' action = "{$config['phpurl']}/changebasic.php">


and it should be working now []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

(sorry bout that) []https://www.ubbdev.com/threads/php/images/icons/crazy.gif[/]

I have attached a new text file with this additional step listed in it. Also, the old text file is no longer there so I guess I would have had to upload another one anyhow.. []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

hmmmm... wait... guess I can't upload... lol oh well you can see what needs to be changed now. It should work. []https://www.ubbdev.com/threads/php/images/icons/wink.gif[/]
Posted By: just4clicks Re: [5.5] Upload Userpic (revisited) - 02/08/2002 5:53 PM
Hey Dave...how hard would it be to add an "error" message that they uploaded something other than a .jpg or a .gif, or the image they uploaded is too big? Maybe an error image that shows "no avatar uploaded" instead of a broken image...

Otherwise...GREAT JOB My members love it!
http://www.backstagejbj.com/ubbthreades/index.php
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/08/2002 6:00 PM
If they try to upload something other than .gif or .jpg or if the file is larger than what's configured they will recieve an error message informing them of the problem. []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

You can download this at http://www.chattersonline.com/test for the time being. Just click on the "File Attachments" link in the menu box for a list of attachments. []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]
Posted By: just4clicks Re: [5.5] Upload Userpic (revisited) - 02/08/2002 6:54 PM
I guess I've configured something wrong...it works, but I get no errors.

http://www.backstagejbj.com/ubbthreads/index.php
Posted By: just4clicks Re: [5.5] Upload Userpic (revisited) - 02/08/2002 7:02 PM
Here's what I get for errors if the image is too big:

it gives this error: Warning: Unable to open 'none' for reading: No such file or directory in /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/changebasic.php on line 116

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/changebasic.php:116) in /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/ubbt.inc.php on line 959

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/changebasic.php:116) in /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/ubbt.inc.php on line 960

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/changebasic.php:116) in /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/ubbt.inc.php on line 961

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/changebasic.php:116) in /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/ubbt.inc.php on line 962

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/changebasic.php:116) in /usr/local/psa/home/vhosts/backstagejbj.com/httpdocs/ubbthreads/ubbt.inc.php on line 963

And here's a post with a .bmp (how'd that get in there?) that's too big:

http://www.backstagejbj.com/ubbthre...ew=collapsed&sb=5&o=0&fpart=
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/08/2002 7:16 PM
hmmmm not sure how a .bmp got into your posts if your not allowing them... go to my test site and try to upload a picture that's not a .gif or .jpg and over 100k in size... it was not letting me do it but maybe that was just me. I'm using the exact same code in the 1.5.1 text file I have posted in the file attachments area.

Let me know how it goes... I don't think I have any errors but it's not like that don't ever happen... lol
Posted By: XanthViper Re: [5.5] Upload Userpic (revisited) - 02/08/2002 10:49 PM
Yep thats it. I didn't even think about looking for that. Thanks.
Posted By: ScottCargill Re: [5.5] Upload Userpic (revisited) - 02/09/2002 3:41 PM
All I get is ...............

Warning: Unable to create '????/?????/??????/????/attach/1.gif': No such file or directory in /????/??????/????????/phpforum/changebasic.php on line 116

Warning: Cannot add header information - headers already sent by (output started at /home/sansoo/public_html/phpforum/changebasic.php:116) in /??????/??????/?????????/phpforum/ubbt.inc.php on line 959

when I try to upload a pic. (.gif) It doesn't upload the file saying it can't and erroring out, but it does change the link in the users profile to indicate that it should be looking for the file.

My settings are set to allow .gif,.jpg,.etc etc etc.

Any ideas dave?

Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/10/2002 2:19 AM
Your using 5.5 correct? (just making sure.. lol) []https://www.ubbdev.com/threads/php/images/icons/wink.gif[/]

Does your forums allow file attachments? If not you may not have created the folder/directory needed for the pictures to be placed in.

Are there any other hacks added to the changebasic.php and the editbasic.php files?

Posted By: ScottCargill Re: [5.5] Upload Userpic (revisited) - 02/10/2002 4:28 AM
In reply to:

Your using 5.5 correct? (just making sure.. lol)

Does your forums allow file attachments? If not you may not have created the folder/directory needed for the pictures to be placed in.

Are there any other hacks added to the changebasic.php and the editbasic.php files?




5.5.1 and I've got it set to allow .gif,.jpg,.txt,.mpg,.mp2,.avi,.rm,.wmv,.mov There shouldn't be anything changed in either of those two files.

And welllllll POOP, bareing in mind that I've had 3 hours sleep in the last 30.

I just tried a file attachment straight through a posted message and go a can't create such and such error. Looks like my attachment directory is boogered.

Forgot a / in the attachments path....[]https://www.ubbdev.com/threads/php/images/icons/blush.gif[/]

Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/10/2002 5:24 AM
hehehe well I'm glad it's working now []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]

right?

lol []https://www.ubbdev.com/threads/php/images/icons/wink.gif[/]
Posted By: ScottCargill Re: [5.5] Upload Userpic (revisited) - 02/10/2002 3:30 PM
Yep! Working like a champ now.... heh heh....

Posted By: caymuc Re: [5.5] Upload Userpic (revisited) - 02/17/2002 12:44 PM
shouldn't the form have a "name" to better identify it?

<form method = POST action = "{$config['phpurl']}/changebasic.php" enctype='multipart/form-data' name="ProfileForm">
Posted By: JustDave Re: [5.5] Upload Userpic (revisited) - 02/17/2002 2:20 PM
I'm not sure if you can reference the form with it's name in php as an object like you can with java script. I haven't seen anything in php done this way. It wont hurt though. []https://www.ubbdev.com/threads/php/images/icons/wink.gif[/]
Posted By: dRiver Re: [5.5] Upload Userpic (revisited) - 02/26/2002 9:13 PM
Thanx JustDave

worx great
Posted By: caymuc Re: [5.5] Upload Userpic (revisited) - 03/09/2002 5:39 PM
Your code is great but I found out it is not finding all kinds of false formats:

testtext.txt
testtxt.
badcode.gif.php
...and so on...

Some files were rejected, but without error warning.

I played around and found this to work better:

// Let's see if we want this type of file
if (!preg_match("/(\.jpg|\.gif)$/i","{$HTTP_POST_FILES['U_PIC_FILE']['name']}")) {


What would yo say to that code?

Greetings
Posted By: caymuc Re: [5.5] Upload Userpic (revisited) - 03/09/2002 5:42 PM
Oh I see []/forum/images/icons/smile.gif[/]
I have to forms on the page and use JavaScript,
and want to make sure, JavaScript is referencing
the right form.

Maybe that extra caution was not necessary []/forum/images/icons/smile.gif[/]
Posted By: Kordegnen Re: [5.5] Upload Userpic (revisited) - 03/11/2002 10:33 AM
i cant seem to get the link to work to the hack ??

anyone

thomas
Posted By: JoshPet Re: [5.5] Upload Userpic (revisited) - 03/12/2002 12:58 AM
Daves got it at his test board for download...until they fix the files here.

http://www.chattersonline.com/test
then click File Attachments
Posted By: AllenAyres Re: [5.5] Upload Userpic (revisited) - 03/12/2002 7:04 AM
Links fixed to most all attachments:

https://www.ubbdev.com/threads/php/uploads/43983-5.5-uploadpic.1.5.txt

[]/forum/images/icons/smile.gif[/]
© UBB.Developers