Computer Science Canada

Uploading/Apache/Ftp ???!!!

Author:  Homer_simpson [ 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?!

Author:  Amailer [ Wed Aug 20, 2003 11:17 pm ]
Post subject: 

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

hehe

http://www.hotscripts.com/PHP/Tips_and_Tutorials/File_Manipulation/

Author:  Blade [ Thu Aug 21, 2003 3:14 pm ]
Post subject: 

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

file called upload...
code:

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

Author:  PaddyLong [ Thu Aug 21, 2003 9:56 pm ]
Post 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

Author:  Homer_simpson [ Thu Aug 21, 2003 10:55 pm ]
Post 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

Author:  Amailer [ Fri Aug 22, 2003 12:24 am ]
Post subject: 

So...
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 )

;D

Author:  Homer_simpson [ Fri Aug 22, 2003 4:09 pm ]
Post subject: 

pretty much... yeah...

Author:  Amailer [ Fri Aug 22, 2003 5:50 pm ]
Post subject: 

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

BUT I COULD create it again Very Happy...

Author:  Homer_simpson [ Fri Aug 22, 2003 6:23 pm ]
Post subject: 

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

Author:  Amailer [ Fri Aug 22, 2003 6:45 pm ]
Post 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 layout...im 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?!?!

Author:  Homer_simpson [ Fri Aug 22, 2003 9:34 pm ]
Post 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:

$user=GetUserByID($IDNumber);
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...
code:
//Must be connected to database and GetLinkByID must be defined b4
function PrintLink($id,$x,$y,$class)
{
$templink=GetLinkByID($id);
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

Author:  Amailer [ Fri Aug 22, 2003 9:52 pm ]
Post 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

Author:  Homer_simpson [ Fri Aug 22, 2003 10:14 pm ]
Post subject: 

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

Author:  Amailer [ Fri Aug 22, 2003 10:25 pm ]
Post subject: 

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


TABLE: 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)


TABLE: LINKS
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'];

and...now i place the 2 variables
$link_name and $layout ...in my script or w/e.

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


I KNOW THATS NOT POSSIABLE TO DO...
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

Author:  Homer_simpson [ Fri Aug 22, 2003 10:48 pm ]
Post 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
2.one of your objects(A link in this case)

so here's how the layout table should look like:
layout_line:int
layout_info:text
layout_commandtype:int
layout_id:int

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.

code:

while(fetchmysqlarray(blahblah))
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
code:

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:

code:
<p>
<a href="someurl.com(someurl is retrieved from link table where id =3 in this case)">link1</a>

Author:  PaddyLong [ Mon Aug 25, 2003 10:57 am ]
Post subject: 

...no offense but the idea of having no html in any file and having the layout stored in a database seems like a bad idea to me .... I can understand having like some values like table widths or font and stuff like that in the database ... but having your actual html code in the database just doesn't seem like a good idea ...

Author:  Amailer [ Mon Aug 25, 2003 11:24 am ]
Post subject: 

Whys that?

Author:  Homer_simpson [ Mon Aug 25, 2003 12:57 pm ]
Post subject: 

i think he's trying to make it so he can edit his webpages online...

Author:  Amailer [ Mon Aug 25, 2003 1:12 pm ]
Post subject: 

Ya...and others can also...
well i could do this.

Make it edit a file...
But i don't know about that.

Author:  Homer_simpson [ Mon Aug 25, 2003 1:18 pm ]
Post subject: 

why dont u just do what octopi did... using php, open a file edit it and save it...

Author:  Amailer [ Mon Aug 25, 2003 1:48 pm ]
Post subject: 

Amailer wrote:

Make it edit a file...
But i don't know about that.

Author:  Homer_simpson [ Mon Aug 25, 2003 6:19 pm ]
Post subject: 

u mean u dunno how to do it?

Author:  Amailer [ Mon Aug 25, 2003 6:25 pm ]
Post subject: 

no i mean i don't wanna do it -.-


: