Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-05-2004, 10:32 AM   #1
Solid State Member
 
kdflash's Avatar
 
Join Date: Jul 2004
Posts: 6
Send a message via AIM to kdflash
Default Upload scritp

What i want on my site is users can upload actionscripts for other users to see.But i want it so i dont need to get it and manually put it on.I want it so when they fill it in and press submit then its their on the page for all to see.

How can i do this?
__________________

kdflash is offline   Reply With Quote
Old 07-06-2004, 11:40 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: Upload scritp

firstly, what server side language are you using?
asp, aspx, php, perl?
once we know the technologies you are using then we'll be able to help further.
__________________

root is offline   Reply With Quote
Old 07-06-2004, 02:28 PM   #3
Solid State Member
 
kdflash's Avatar
 
Join Date: Jul 2004
Posts: 6
Send a message via AIM to kdflash
Default

im using php.
kdflash is offline   Reply With Quote
Old 07-06-2004, 06:32 PM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: Upload scritp

OK, heres a quick example...
Code:
<?php
$function = $_GET['action'];
$currentloc = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];

switch ($function)

    {
        case 'upload':
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of
// $_FILES.  In PHP earlier then 4.0.3, use copy() and is_uploaded_file()
// instead of move_uploaded_file

$uploaddir = '/var/www/html/upload/uploads/';
$uploadfile = $uploaddir. basename($_FILES['userfile']['name']);
print $currentloc;
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    print "File is valid, and was successfully uploaded. ";
    print "Here's some more debugging info:\n";
    print_r($_FILES);
} else {
    print "Possible file upload attack!  Here's some debugging info:\n";
    print_r($_FILES);
}
print "</pre>";

        break;
        default:
        print $currentloc;
        echo '<html><head><title>Upload files</title></head>\n
        <body bgcolor = "#78F0B4">
        <Font color = "#ff0000">
        <h2>Upload a file</h2>
        <form enctype="multipart/form-data" action="upload.php?action=upload" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="30000000">
Send this file: <input name="userfile" type="file"><br>
<input type="submit" value="Send File">
</form>';
        break;
    }
?>
I got the example from the PHP manual I think (it was quite a while ago and is now sitting on a server of mine).

This will send the file to an upload directory, all you have to do is pass the upload directory as a variable. I guess to browse through files you could use a loop to check if a file exists an then display it if it does, if it doesn't, finish the loop and end the page.

(hope this helps)
root is offline   Reply With Quote
Old 07-06-2004, 07:52 PM   #5
Solid State Member
 
kdflash's Avatar
 
Join Date: Jul 2004
Posts: 6
Send a message via AIM to kdflash
Smile

hanks i will work on that
kdflash is offline   Reply With Quote
Reply

« Iframes | Web Cam »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 02:27 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0