Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 Uploading/Apache/Ftp ???!!!
Index -> Programming, PHP -> PHP Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message

PostPosted: Wed Aug 20, 2003 11:06 pm   Post subject: Uploading/Apache/Ftp ???!!!

now i know how to upload files into a ftp... but when i'm using apache there aint no ftp Confused so how can i upload my files using php?!

PostPosted: Wed Aug 20, 2003 11:17 pm   Post subject: (No subject)

err..create a uploader.....
or dl 1


PostPosted: Thu Aug 21, 2003 3:14 pm   Post subject: (No subject)

first page as a form...
<form method=post action=upload.php enctype=multipart/form-data>
<input type=file name=file>
<input type=submit value=Continue>

file called upload...

$dir = "test/";
if(!copy($file, $dir . $file_name)) {
die("Could not copy file");
else {
echo "File copied successfully";

PostPosted: Thu Aug 21, 2003 9:56 pm   Post subject: (No subject)

hmm.. after rereading this post.. I wonder if he meant how do you put the files into your webserver?

if that is the question... then they go into the htdocs subdir in your apache install dir

PostPosted: Thu Aug 21, 2003 10:55 pm   Post subject: (No subject)

dont worry about it man... i got it working how i wanted to... i make a record for each file that gets uploaded on mysql database and i upload files to my desired directory... Very Happy

PostPosted: Fri Aug 22, 2003 12:24 am   Post subject: (No subject)

You need(ed) a script that,

Allows a user to upload a file (Maby with only certin extentions?)
The user can select which dir he/she wants the file to be places?
And then upload...while uploading the script gets all the information of the file, store it in a DB?

And then it finishes uploading (of course)
And there is a place where you can display the uploaded files?

(like a admin center, to delete, edit (file info or content) and etc )


PostPosted: Fri Aug 22, 2003 4:09 pm   Post subject: (No subject)

pretty much... yeah...

PostPosted: Fri Aug 22, 2003 5:50 pm   Post subject: (No subject)

Oh ok...
HMM i think i already made that...don't know where it is..

BUT I COULD create it again Very Happy...

PostPosted: Fri Aug 22, 2003 6:23 pm   Post subject: (No subject)

ya i've already got it working... every time i upload a file a new record gets created in some table...

PostPosted: Fri Aug 22, 2003 6:45 pm   Post subject: (No subject)

Oh ya...oh well gatta then get back to my project...
OH that reminds me...(forget making a new topic)

Ok, now im having troble displaying the trying to make this project so that it has no HTML in any file.

So...i wanted to put the whole layout in a database...where you can edit it and etc.

But this is the problem.

Now this is how my site is setup.
I got a table (in my database) for the links- (id, url, name and etc)

And i also got the sites layout in another table...
So how do i display the links from the links table, into the sites layout..which is in the database?

err HOW on earth to explain this?!?!

PostPosted: Fri Aug 22, 2003 9:34 pm   Post subject: (No subject)

i think i know what u are trying to do...well here's what i would do...each table must have an "ID" section which is an INT and is set on autoincrement... now u have to design a function that would return the complete info of an id.... for example in my code... i only type this:

echo $user[name],$user[age],$user[gender],etc;

but in yer case u got link to display on your page this is how i would do it...
//Must be connected to database and GetLinkByID must be defined b4
function PrintLink($id,$x,$y,$class)
echo "<a href='".$templink[address]."' class='".$class."' style='position:absolute;left:".$x.";top:".$y."'>".$templink[text]."</a>";

Now if u want yer pages to have no html in it u gotto make elements in yer database so yer pages should looksomething like this:

function PrintLink(1,10,10,"normallink");
function PrintLink(2,10,20,"normallink");
function PrintLink(3,10,30,"normallink");
function PrintLink(4,10,40,"normallink");

Hope I made sence Confused

PostPosted: Fri Aug 22, 2003 9:52 pm   Post subject: (No subject)

ERrr it does, and i knw how to do that another way..but thats not what i want.

All the HTML '' of the site is in a DATABASE, and a table called lets say 'layout'
(oh and BTW, the place the links have to go is replaced by the variable $link_name)

And the links are keeped in a table called 'links'

Now how do i display those links in the information given from the layout table?

Could i do this:
have a link variable $link_name

and this variable $layout has the layout (the HTML from the table LAYOUT).

Would it display the links? cuz the information from the 'layout' table contains the variable $link_name....

HOPE THAT YOU UNDERSTAND...i kind do/don't Confused

PostPosted: Fri Aug 22, 2003 10:14 pm   Post subject: (No subject)

so u want to have your whole layout(tables,forms,links,texts,etc) in one variable called $layout?!

PostPosted: Fri Aug 22, 2003 10:25 pm   Post subject: (No subject)

no no no...
...ahh ok 1 sec now look this is how the table is for the LAYOUT

FIELDS: layout_id, layout_info, layout_name

(Remember, now iv already inserted my information in the field layout_info-[the html], but in that HTML...there is a variable called $link_name..Thats where the link will go)

FIELDS: link_id, link_url, link_name

Now iv alreayd selected everything from the LAYOUT table, and iv keeped the information selected from the field layou_info as $layout = $row['layout_info'];

And now iv also selected the information from the LINKS table, and keeped the link_name as $link_name = $row['link_name']; i place the 2 variables
$link_name and $layout my script or w/e.

Since the variable $link_name is there it should display the links ...

But is there another way to do it? ATLEAST CLOSE TO THAT?
having the links in 1 table and the LAYOUT (HTML OF THE SITE) in another TABLE?!!?

this is crazy

PostPosted: Fri Aug 22, 2003 10:48 pm   Post subject: (No subject)

well i still can't see how this could do u any good...but here goes...But Youl'll need to create a table for each page...
well in yer layout table u can have each line as a record...
now each record can be 2 things:
1. normal html text of your objects(A link in this case)

so here's how the layout table should look like:

now first we check see what the command type is if it is 1(plain html we just print it) if it's 2(a link type) we get the link data from the id and display it.


if $row[commandtype]=1 (normal html)
echo $row[layout_info];

if $row[commandtype]=2 (a link that has to be read from database)
$templink= get FROM links table the record WHERE linkname='$row[command_id]'

echo"<a href=".$templink[url].">".$row[layout_info]."</a>";

so if yer page has 3 lines layout table will be like this : will be like this

Line    info                 commandtype              commandid
1        <p>                       1                  null
2        link1                      2                     3
3       </p>                      1                  null

now that table should display something like this in your page:

<a href=" is retrieved from link table where id =3 in this case)">link1</a>
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 23 Posts ]
Goto page 1, 2  Next
Jump to: