http file upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jogen143
Forum Newbie
Posts: 15
Joined: Tue Mar 25, 2003 2:51 am

http file upload

Post by jogen143 »

hi guys

I want a script to upload files through http and at the same time wants write the file name in to the database.

any help would be much appreciated

thanks in advance
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

How far have you gotten with the code?

Mac
jogen143
Forum Newbie
Posts: 15
Joined: Tue Mar 25, 2003 2:51 am

http file upload

Post by jogen143 »

i dont have any code at all.

just want to upload some pdf's through http to a folder and let user download by clicking the path

for example

http://www.mysite.com/meterials/course1.pdf

i want to write (meterials/course1.pdf) to the database

thanks
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Are you looking for us to write the code for you because that isn't the way we tend to work. There has to be some attempt on your part to find the solution.

For file uploading the best place to start is here:
http://php.net/manual/en/features.file-upload.php

Mac
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

Code: Select all

<?php
require_once('YourCode.php');
if ( is_broken( $yourCode )) {
   AskForHelp( 'www.devnetwork.net' );
} else {
   AttemptToCreate( 'uploadScript' );
}
?>
There's a start for you :)
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

a follow up to that is:

Code: Select all

<?php

require_once('YourCode.php');
if (is_broken($yourCode)) {
AskForHelp('www.devnetwork.net');

} else {
$tries = /see what you concious have to say;
for($i=0; $i<$tries; $i++) {
AttemptToCreate('uploadScript');
}

}
?>
Basicly, the common rule is - "If you don't try, we don't help you". It's not that we don't want to. It's just that we won't be able to help you effeciently. Anyhow, just google a tutorial on uploading and renaming files. Do some research on copy() and rename() in the php.net manual.

Good luck,

-Nay

ps: the code me and evilMind wrote are a joke, don't test it out! :lol:
Post Reply