Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

91 users online



Allowing uploading to server?

Allowing uploading to server?

Currently viewing this thread: 1 (0 members and 1 guests)


wookiee2cu

wookiee2cu

Neverside Newbie
Status: Offline!

Allowing uploading to server?

I'm totally lost here. I have seen this on a site and it's exactly what I want but I can't find any information on Google regarding how to do it. Basically I want a page where a person will go and enter a name and password. Once this is entered, a window browser will open up and they select the files from their computer that they want to upload to the server and they just click an upload button. I need it to be able to handle several files selected to be up loaded and I want to set it up so they don't even see the httpdocs or anything and that they only have access to one predefined folder that I create on the server. Reason for this is my sister just had a baby. I want to set up a site for them. They live 1,300 miles away and I want to set it up so that they can go to a web address, log in, select pictures and videos and click 'upload' and be done with it and not have to worry about messing up other folders. Then I will log in, move the images to another folder, build the pages and update their site. Any one have any ideas? Any suggestions are greatly appreciated, thanks in advance.

aonic

aonic

Neversidian
Status: Offline!

this is server side stuff, i can make a script for u when i come home from work. if someone else doesnt get to it first!!

___________________

-Developer
-Forum Leader
-NeverNET

DigitalDream

DigitalDream

ruby on weapon
Status: Offline!

i have this upload script ready but i havent add the authentication system (login). i'll update the script and upload it here. not gonna be quick though. maybe u should just wait for aonic Grin

___________________

digitalDream // complete Webdesign solution //
- - - - - - [ end signature ] - - - - - -

wookiee2cu

wookiee2cu

Neverside Newbie
Status: Offline!

Thank you Aonic and DigitalDream, which everone of you could upload the script it woud be great. Thanks again!

aonic

aonic

Neversidian
Status: Offline!

here, made it in a rush (10 mins )

PHP:

<?php
session_start
();

$check_user 'admin';
$check_pass 'admin';
$num_of_uploads 5;
$uploaddir getcwd().'/';

if(
$_SESSION['logged_in']){
    if(isset(
$_FILES["userfiles"]))
    {
        
$message '';
        foreach (
$_FILES["userfiles"]["error"] as $key => $error)
        {
           if (
$error == UPLOAD_ERR_OK) {
               
$tmp_name $_FILES["userfiles"]["tmp_name"][$key];
               
$name $_FILES["userfiles"]["name"][$key];
               
$message .= (move_uploaded_file($tmp_name$uploaddir.$name)) ? "$name was succesfully uploaded.<br />" "Error while uploading $name.<br />";
           }
        }
    }
?>
<?=$message?>
<br />
Upload Files: <br />
<form enctype="multipart/form-data" action="#" method="POST">
    <? while($num_of_uploads--){ ?>
    <input name="userfiles[]" type="file" /><br />
    <? ?>
    <input type="submit" value="Send File(s)" />
</form>
<?
    
}elseif($_POST['user'] == $check_user && $_POST['pass'] == $check_pass){
    
$_SESSION['logged_in'] = 1;
    
header('Location: '.$_SERVER['PHP_SELF']);

}else{
    
$message = ($_POST['submit']) ? 'Error with authentication.<br />' '';
?>
<form action="#" method="post">
<?=$message;?>
user: <input type="text" name="user" /><br />
pass: <input type="text" name="pass" /><br />
<input type="submit" name="submit" />
</form>
<?
}
?>

___________________

-Developer
-Forum Leader
-NeverNET

mcrob

mcrob

Neverside Newbie
Status: Offline!

<?php
// Whatever your database connection is
// Lets say you have a form and a submit button. The submit button name is Submit
// Your upload file field name is uploadfile

if(isset($_POST['Submit'])){ # Means if the submit button is a stored variable.
$filename = $_FILES['uploadfile']['name']; // Get the name of the file and the extension
$filetype = $_FILES['uploadfile']['type']; // Get the type of file it is (eg: image/jpeg/ audio/mp3/ application/doc etc)
$filesize = $_FILES['uploadfile']['size']; // Get the size of the file
$filetmp = $_FILES['uploadfile']['tmp_name']; the directory where the files are stored in the temp folder of your computer

move_uploaded_file("$filetmp","whereever/".$filename); // Now from there your going to move the file from your temporary folder to your destinated folder. And thats it

} // Close the tag from the opening if statement

// Finished! Wink

?>

___________________

RoB

Last edited by mcrob, November 20th, 2005 10:39 AM (Edited 1 times)

wookiee2cu

wookiee2cu

Neverside Newbie
Status: Offline!

Thanks aonic and mcrob, it is greatly appreciated. Unfortunately this is way over my head and I'm going to have to find an alternative. I'm not familiar with PHP (if that's what this is) and how to implenment it on my server space. Thanks again for your help!

Samurai_Zero

Samurai_Zero

Procrastination Guru
Status: Offline!

Take a look at CDude's awesome Uploader script. Its a rather well written little programn.

Hope that is indeed what you were looking for.

[Edit] Just thought I'd mention that CeleronDude's script does however require php on the server, but if you have php its a simple enough script to setup.

___________________

Bored? Join us at #Central on irc.Neverside.com

Last edited by Samurai_Zero, November 22nd, 2005 06:07 AM (Edited 1 times)

aonic

aonic

Neversidian
Status: Offline!
Originally posted by wookiee2cu:

Thanks aonic and mcrob, it is greatly appreciated. Unfortunately this is way over my head and I'm going to have to find an alternative. I'm not familiar with PHP (if that's what this is) and how to implenment it on my server space. Thanks again for your help!

you just needed to make a php file on your server and paste my code in there, and the login was admin/admin

___________________

-Developer
-Forum Leader
-NeverNET

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0095 seconds.