Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - PHP FTP Code | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
TheGreatWhiteDope Koopa Banned Level: 16 Posts: 80/108 EXP: 19462 For next: 794 Since: 01-05-05 Since last post: 8 days Last activity: 4 days |
| ||
I have recently been trying to make an ftp (or upload code) that only accepts images that are 11x11 (gd) and under 10000b but its being a pain. Can somebody please help me with this or make a quick code for it? (Yes this is for an AB, but, my problem doesn't have any relation to it so I decided to post it here ) (edited by TheGreatWhiteDope on 10-05-05 06:40 PM) |
|||
Dei* Nipper Plant Level: 26 Posts: 325/412 EXP: 97995 For next: 4280 Since: 06-18-05 From: USA, Florida Since last post: 2 days Last activity: 1 day |
| ||
You know, Id probably help you if I wasnt violating 15 different board rules and offending everyone on the board. ON TOP OF THAT YOUR IMAGES ARE LAGGING ME 56K CHARMS OUT! | |||
DarkSlaya POOOOOOOOOOOORN! Level: 88 Posts: 4167/4249 EXP: 6409254 For next: 241410 Since: 05-16-04 From: Montreal, Quebec, Canada Since last post: 8 hours Last activity: 5 hours |
| ||
Dei*: Shut up, will ya? This is intended to be a serious forum where people answer questions. As for you, TGWD: Wouldn't it be easier to actually resize the image after having it uploaded (I Know GD can do that) |
|||
Narf Hi Tuvai! (reregistering while banned) Level: 16 Posts: 88/100 EXP: 17634 For next: 2622 Since: 12-26-04 Since last post: 22 hours Last activity: 14 hours |
| ||
getimagesize() and filesize(), anyone? | |||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 630/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
Originally posted by Dei*That's pretty funny, since TGWD's layout loads fine for me, but your crap under your sloganizer thing takes forever to load. Originally posted by DarkSlayaThat's true. I've been messing with Coppermine, and it resizes the images to make the thumbnails and previews, and stores them on the server. Maybe you can pillage their code for how to do it? Originally posted by NarfOr that. |
|||
TheGreatWhiteDope Koopa Banned Level: 16 Posts: 83/108 EXP: 19462 For next: 794 Since: 01-05-05 Since last post: 8 days Last activity: 4 days |
| ||
Originally posted by Narf Err, I know all of that crap, I just don't understand how to add the restrictions to the upload code itself. For example, my upload code let you upload anything, including a php scrit, which is bad (Duh ), but I want to know how to set restrictions so it only allows images. I get the image size thing, I just forgot the name of it, I though it was gd (getdimensions). |
|||
Narf Hi Tuvai! (reregistering while banned) Level: 16 Posts: 89/100 EXP: 17634 For next: 2622 Since: 12-26-04 Since last post: 22 hours Last activity: 14 hours |
| ||
I don't get it, you know how the getimagesize() and filesize() functions work and you know how to make an upload script. That's all there is to it as far as I know. <? $maxsize_kb='50'; $allowed_extensions='jpg bmp gif png txt etc'; if($_POST['perform']=='upload'){ if($_FILES['uploadedfile']['name']){ if(filesize($_FILES['uploadedfile']['tmp_name'])<=($maxsize_kb*1024) && stristr($allowed_extensions,substr($_FILES['uploadedfile']['name'],-3))){ copy($_FILES['uploadedfile']['tmp_name'],'uploads/'.$_FILES['uploadedfile']['name']); }else{ if(filesize($_FILES['uploadedfile']['tmp_name'])>($maxsize_kb*1024)){die('Too big!');} if(!stristr($allowed_extensions,substr($_FILES['uploadedfile']['name'],-3))){die('Unallowed extension!');} } }else{ die('no file'); } } echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" enctype=\"multipart/form-data\"> <input type=\"hidden\" name=\"perform\" value=\"upload\" /> <input type=\"file\" name=\"uploadedfile\" /> <input type=\"submit\" value=\"Upload File\" /> </form>"; ?> And zOMEG, this board really needs a [code] tag. |
|||
TheGreatWhiteDope Koopa Banned Level: 16 Posts: 85/108 EXP: 19462 For next: 794 Since: 01-05-05 Since last post: 8 days Last activity: 4 days |
| ||
Thanks man, one problem though, Warning: copy(uploads/test.gif): failed to open stream: Permission denied I changed the file permissions to 0777 but that didn't change anything.. I really don't know much about permissions, is it my webserver? |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7512/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
I had that problem too, and the only solution I found was to create an empty file with the desired name via FTP and change its attributes to 777. That doesn't do much good when you're using variable names though. You might be able to create a 'temp file' with write permissions, and upload all files 'into' it (rather than creating a new file), then copy the uploaded file to its real name. Not sure if this would work. It could cause problems if multiple people tried to upload at once though.Originally posted by Narf < |
|||
Narf Hi Tuvai! (reregistering while banned) Level: 16 Posts: 90/100 EXP: 17634 For next: 2622 Since: 12-26-04 Since last post: 22 hours Last activity: 14 hours |
| ||
Originally posted by TheGreatWhiteDopeIn that scripts I posted I put uploaded files in the 'uploads' folder, change that folder's permission to CHMOD 0777. And <code> sucks, by the way. |
|||
Xkeeper The required libraries have not been defined. Level: NAN Posts: 3670/-863 EXP: NAN For next: 0 Since: 03-15-04 Since last post: 2 hours Last activity: -753366 sec. |
| ||
Make the directory you're uploading to 777. Edit: Argh I hate you. (edited by OH NOES on 10-07-05 02:02 AM) |
|||
TheGreatWhiteDope Koopa Banned Level: 16 Posts: 86/108 EXP: 19462 For next: 794 Since: 01-05-05 Since last post: 8 days Last activity: 4 days |
| ||
Heh, that works, thanks guys. Should have known to change the folder's permission and not the file's permission. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - PHP FTP Code | | | |