Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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

Attachments
43975-5.5-uploadpic.1.0.txt (0 Bytes, 64 downloads)

Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3


- Allen wavey
- What Drives You?
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Would adding .gif be a major hassle? A lot of people use gif as their avatar...


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
nope not at all... actualy working on that right now... LoL

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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[/] )
Attachments
43983-5.5-uploadpic.1.5.txt (0 Bytes, 52 downloads)

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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[/]


- Allen wavey
- What Drives You?
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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[/]

Joined: Apr 2000
Posts: 76
Journeyman
Journeyman
Joined: Apr 2000
Posts: 76
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.


i run sdstreetracing.com and streetracing.com
Sponsored Links
Joined: Feb 2002
Posts: 4
Lurker
Lurker
Offline
Joined: Feb 2002
Posts: 4
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.

Joined: Apr 2000
Posts: 76
Journeyman
Journeyman
Joined: Apr 2000
Posts: 76
Hopefully Dave will have something for us soon []https://www.ubbdev.com/threads/php/images/icons/smile.gif[/]


i run sdstreetracing.com and streetracing.com
Joined: Feb 2002
Posts: 10
Newbie
Newbie
Offline
Joined: Feb 2002
Posts: 10
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!


Thanks!
Scott Salvi
Just4Clicks
Joined: Apr 2000
Posts: 76
Journeyman
Journeyman
Joined: Apr 2000
Posts: 76
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.


i run sdstreetracing.com and streetracing.com
Joined: Feb 2002
Posts: 10
Newbie
Newbie
Offline
Joined: Feb 2002
Posts: 10
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).


Thanks!
Scott Salvi
Just4Clicks
Joined: Aug 1999
Posts: 184
Member
Member
Offline
Joined: Aug 1999
Posts: 184
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.


Silly ricer.. Wings are for airplanes!
Joined: Feb 2002
Posts: 10
Newbie
Newbie
Offline
Joined: Feb 2002
Posts: 10
I thought it used the "files" directory from the attachments???


Thanks!
Scott Salvi
Just4Clicks
Joined: Apr 2000
Posts: 76
Journeyman
Journeyman
Joined: Apr 2000
Posts: 76
Nothing in this scripts uses Avatars. Uses the config file attachment folder.


i run sdstreetracing.com and streetracing.com
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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[/]

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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[/]

Joined: Feb 2002
Posts: 10
Newbie
Newbie
Offline
Joined: Feb 2002
Posts: 10
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


Thanks!
Scott Salvi
Just4Clicks
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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[/]

Joined: Feb 2002
Posts: 10
Newbie
Newbie
Offline
Joined: Feb 2002
Posts: 10
I guess I've configured something wrong...it works, but I get no errors.

http://www.backstagejbj.com/ubbthreads/index.php


Thanks!
Scott Salvi
Just4Clicks
Joined: Feb 2002
Posts: 10
Newbie
Newbie
Offline
Joined: Feb 2002
Posts: 10
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=


Thanks!
Scott Salvi
Just4Clicks
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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

Joined: Apr 2000
Posts: 76
Journeyman
Journeyman
Joined: Apr 2000
Posts: 76
Yep thats it. I didn't even think about looking for that. Thanks.


i run sdstreetracing.com and streetracing.com
Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
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?


Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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?


Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
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[/]


Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273

Joined: Feb 2001
Posts: 104
Journeyman
Journeyman
Offline
Joined: Feb 2001
Posts: 104
Yep! Working like a champ now.... heh heh....


Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
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">

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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[/]

Joined: Nov 2001
Posts: 54
Junior Member
Junior Member
Offline
Joined: Nov 2001
Posts: 54
Thanx JustDave

worx great

Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
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

Last edited by caymuc; 03/09/2002 10:47 AM.
Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
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[/]

Joined: Apr 2001
Posts: 186
Member
Member
Offline
Joined: Apr 2001
Posts: 186
i cant seem to get the link to work to the hack ??

anyone

thomas

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Daves got it at his test board for download...until they fix the files here.

http://www.chattersonline.com/test
then click File Attachments

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
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[/]


- Allen wavey
- What Drives You?

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)