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.
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.
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
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[/]
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.
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.
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).
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[/]
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">
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[/]
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...
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[/]
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:
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
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.
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.
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[/]
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[/]
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.