Uploading Files


Forum: Other Help Topics
Topic: Uploading Files
started by: jnymris

Posted by jnymris on June 08 2007,21:38
I have created a way i can upload files using php but i cannot upload the files because of the security settings the folder i'm trying to upload it to is opt/lampp/etc so it's a system folder i believe i cann't change that so anyone can edit these files.

I've though about installing a ftp server on dsl so i could transfer files across from windows to dsl (my coding computer) but again i cannot install any ftp server due to my lack of knowledge it would be great if someone could help me out with either of the two.

Cheers in advance,
-Jny

Posted by mikshaw on June 08 2007,22:04
Can you change what directory is used for uploads? It seems to me that an etc directory would be a bad thing to make writable for all.

What type of application is lampp? a uci?

Posted by jnymris on June 08 2007,22:07
lampp is just xampp for linux, install it and you can run php scipts, sql database etcs on your linux box.

I can since i'm using the code
Code Sample
<?php
if ($_FILES["file"]["size"] < 200000000))
 {
 if ($_FILES["file"]["error"] > 0)
   {
   echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
   }
 else
   {
   echo "Upload: " . $_FILES["file"]["name"] . "<br />";
   echo "Type: " . $_FILES["file"]["type"] . "<br />";
   echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
   echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

   if (file_exists("upload/" . $_FILES["file"]["name"]))
     {
     echo $_FILES["file"]["name"] . " already exists. ";
     }
   else
     {
     move_uploaded_file($_FILES["file"]["tmp_name"],
     "upload/" . $_FILES["file"]["name"]);
     echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
     }
   }
 }
else
 {
 echo "Invalid file";
 }
?>

But this is where i want the code to be, where would i upload it too? which would be able to be uploaded? if i can get it onto my dsl pc then i can move it i surpose although i'd rather a direct uplaod their.

Posted by ^thehatsrule^ on June 08 2007,23:26
mikshaw isn't asking about what the application does, but rather what kind of mydsl extension you loaded.

What do you mean by "this is where i want the code to be"?  First, make sure that upload/ directory exists and is writeable.  If you're not sure, just try /tmp instead.

As for a ftpd, I believe betaftpd is included in the base DSL image, unless you were thinking of another package?

Posted by jnymris on June 09 2007,07:08
I have managed to get it running but id unno wht the username and password's are?

where would the files go to? what location on linux? could i change the location? so when i upload them they will automatically go to the correct location?

Posted by mikshaw on June 09 2007,13:33
If you mean usernames and passwords for the linux users (root, dsl, etc), there are none. You would need to create them yourself.

As for where the files should go, I suppose that's entirely up to you. It just seems to me that there must be a hundred better places than in an etc directory. This directory is typically a system directory intended for configuration files. As such, the only user that should have write access to it is root, and personal files have no place there.

My earlier question about what type of application it is has to do with how the app was installed. The app is in /opt, so I'm guessing it's probably either a uci or tar.gz mydsl extension. If it's uci, then there is NO writing to the directory no matter who you are, since the filesystem itself is read-only.

Posted by jnymris on June 09 2007,19:08
i mean username & passwords for the ftp server that i would use through my ftp.

I gussed it would be totaly up to me, although i have enabled write feature in the folder i wanted them all to be placed. so i'm currently using php to upload them, but i still ahve to delete them manually ;(

Sorry i'm totaly new to linux, It's a tar.gz

So how would i create users for betaftp & how would i start the program?

Posted by jnymris on June 11 2007,05:33
Anyone?
Posted by curaga on June 11 2007,08:48
You can use existing users, just give them a password (passwd dsl) and it asks for a new password for user dsl. Then you can login as dsl.

I've never used betaftpd myself, but try starting it with "betaftpd --help" or just googling for "man betaftpd"

Posted by jnymris on June 11 2007,15:03
When i try to run   sudo /usr/sbin/betaftpd
which it says < http://www.troubleshooters.com/linux/distros/dsl/ > (bookmark it)

it just says:

information about it blah blah
bind(): Address already in use
Giving up.

now i'm running Apache aswell.Does this mean i cannot run both? i need to run both? would it not just place ftp.(myaddress)

also how would i go about adding another use i tried to log in as dsl but i cannot rember my username i tried wht i think but it says log-in failed would it b because of my wrong password or because of the apache is running and not the ftp server? is their anyway i could reset my password? i tried a range of passwords

i tried password --help but it said command not found :S

HELP !

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.