Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - PHP FTP Code
  
User name:
Password:
Reply:
 

UserPost
TheGreatWhiteDope
Posts: 86/108
Heh, that works, thanks guys. Should have known to change the folder's permission and not the file's permission.
Xkeeper
Posts: 3670/-863
Make the directory you're uploading to 777.

Edit: Argh I hate you.
Narf
Posts: 90/100
Originally posted by TheGreatWhiteDope
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?
In 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.
HyperLamer
Posts: 7512/8210
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
And zOMEG, this board really needs a [code] tag.

<code>
TheGreatWhiteDope
Posts: 85/108
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?
Narf
Posts: 89/100
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
Posts: 83/108
Originally posted by Narf
getimagesize() and filesize(), anyone?


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).
Elric
Posts: 630/687
Originally posted by Dei*
ON TOP OF THAT YOUR IMAGES ARE LAGGING ME 56K CHARMS OUT!
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 DarkSlaya
Wouldn't it be easier to actually resize the image after having it uploaded (I Know GD can do that)
That'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 Narf
getimagesize() and filesize(), anyone?
Or that.
Narf
Posts: 88/100
getimagesize() and filesize(), anyone?
DarkSlaya
Posts: 4167/4249
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)
Dei*
Posts: 325/412
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!
TheGreatWhiteDope
Posts: 80/108
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 )
Acmlm's Board - I2 Archive - Programming - PHP FTP Code


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.003 seconds.