Go to Post Andy Baker doesn't go to IRI. IRI comes to Andy Baker. - tim_reiher [more]
Home
Go Back   Chief Delphi > Other > Chit-Chat
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-09-2002, 17:34
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
PHP File Uploading Scripts

um, yeah.

ok, i'm an aspiring coder (read: some lazy guy who has a cheap webserver at home and doesn't like to carry floppy disks to school ), and i was looking around for some beginner level PHP scripts that would let me upload files through the HTTP protocal (err, that's redundant, isn't it...) to my server, from school.

i've seen several ones built into forums (like the one right here), but i don't want to make a forum just to use the upload script . so, i was wondering if there are any standalone scripts that someone could point me too. doesn't need to do much, just let me upload files to one folder and then i'll be happy. if possible, i'd want password protection, but that's not the biggest deal to me.

so, if anyone knows where to get any good scripts that work, please tell me, cause i don't like floppy disks..

and thanks in advance to anyone who can help.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
Reply With Quote
  #2   Spotlight this post!  
Unread 10-09-2002, 17:46
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
i can pull out all the 'forum' stuff from the image gallery, and post it on here.

it used to be stand-a-lone

It will just have the input box for the filename and then save it somewhere on your servers filesystem.

I'll put the script up tonight.
__________________
Brandon Martus
e-mail
Reply With Quote
  #3   Spotlight this post!  
Unread 10-09-2002, 17:57
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
hmm, i guess i could try that. as i said before, it just needs to be able to handle any type of file uploads. of course, i'd rather be able to block other scripts or exe's, or have password protection, but i'm sure i can find a way around that.

one other question. if i took a PHP script that offered password protection, and then put that to login to the file uplaod thing, would that work? i'm not really good with PHP, so i don't really know what i'm talking about . just a random idea that poped into my head. the only other idea i have for password protection is some crazy way through IIS (or apache, if i'm ever not lazy enough to go and make it work), because i think it's possible to do that, but once again, i'm not really sure.

anyways, thanks again brandon.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
Reply With Quote
  #4   Spotlight this post!  
Unread 10-09-2002, 18:10
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
it depends on what kind of security script you have.

the easiest way to do it (if you can & know how) is to set up .htaccess on apache.

If you're going to only have one login, then we can do a real simple username/password thing with the script.

I will make it so it only accepts file extensions that you specify. And has one login.
__________________
Brandon Martus
e-mail
Reply With Quote
  #5   Spotlight this post!  
Unread 10-09-2002, 18:42
DanL DanL is offline
Crusty Mentor
FRC #0097
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Somerville, MA
Posts: 682
DanL is just really niceDanL is just really niceDanL is just really niceDanL is just really niceDanL is just really nice
Send a message via AIM to DanL
...or if you wanna take the cheap-n-easy dan way out....

dump this into a file and name it upload.html:
PHP Code:
<html><head><title>PHP's FileUPLOAD</title></head><body>
<form enctype="multipart/form-data" action="upload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
Username: <input type="text" name="user" size="10"> <br>
Password: <input type="password" name="pw" size="10"><br>
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
</body>
</html> 
and name this upload.php
PHP Code:
<?php 
if ($user != "ian"  ||  $pw != "is_hot")
    exit();

// In PHP earlier then 4.1.0, $HTTP_POST_FILES  should be used instead of $_FILES.
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
    
copy($_FILES['userfile']['tmp_name'], "uploads/".$_FILES['userfile']['name']);
    echo 
"upload success!";
} else {
    echo 
"Possible file upload attack. Filename: " $_FILES['userfile']['name']
    .
"<br>(<a href=\"http://www.php.net/manual/en/features.file-upload.errors.php\">error code</a> "$_FILES['userfile']['error'] .")";
}
?>
That basically uploads the file to a directory called "uploads" in the php script directory (you have to make it) when the username is "ian" and the pw is "is_hot". This is quick, dirty, but it should work (if you have the newer php version and didn't set a crazy anti-global directive thing in the php config file, you need to change the first php line to:
if ($_POST['user'] != "ian" || $_POST['pw'] != "smells")
for more info, go here and here
__________________
Dan L
Team 97 Mentor
Software Engineer, Vecna Technologies

Last edited by DanL : 10-09-2002 at 18:50.
Reply With Quote
  #6   Spotlight this post!  
Unread 10-09-2002, 21:10
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
yeah
thats basically what i was gonna do.

dan saved me some time.

mines a bit more cumbersome and probably confusing..
__________________
Brandon Martus
e-mail
Reply With Quote
  #7   Spotlight this post!  
Unread 10-09-2002, 21:13
mtaman02's Avatar
mtaman02 mtaman02 is offline
FIRST's Spare, Queuer &amp; Tech guy =)
AKA: Mike M. / Mouse =)
no team (FRC Volunteer)
Team Role: Alumni
 
Join Date: Jun 2002
Rookie Year: 2001
Location: Staten Island, NYC
Posts: 1,504
mtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant futuremtaman02 has a brilliant future
Send a message via AIM to mtaman02 Send a message via Yahoo to mtaman02
almost like HTML but different.
Reply With Quote
  #8   Spotlight this post!  
Unread 10-09-2002, 21:18
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
well, the top is html . ..
__________________
Brandon Martus
e-mail
Reply With Quote
  #9   Spotlight this post!  
Unread 10-09-2002, 21:21
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
dan's thing works, but i have some problems with certain files. not a huge thing, just kinda annoying. now, i should probably learn PHP...

EDIT

yeah, i think the problem is with having the file size too small, but i made it much bigger (like, a GB), and it still failed to load a 2 MB file. i'm not sure if it's because it was an exe too, but it gave me errors based on file size. any ideas?
__________________
AIM --> Woloi
Email --> ian@woloschin.com

Last edited by Ian W. : 10-09-2002 at 21:43.
Reply With Quote
  #10   Spotlight this post!  
Unread 10-09-2002, 23:33
evulish's Avatar
evulish evulish is offline
1010100
AKA: Grant Harding
#0084 (WATTNESS (bot: Chuck))
Team Role: Alumni
 
Join Date: Jul 2002
Location: Towanda/Wysox, PA
Posts: 1,434
evulish is just really niceevulish is just really niceevulish is just really niceevulish is just really nice
Send a message via AIM to evulish
Perl rules! Woo! *kicks php*
__________________
I'm a professional web developer. I'm good with PHP, Perl, Java/JSP, some RoR, XML, Javascript (AJAX as well), (x)HTML, CSS, etc.. Validated code is good; fully cross-browser code is better (you comply to your users and the software they use, not the other way around. Sorry!)
Reply With Quote
  #11   Spotlight this post!  
Unread 10-09-2002, 23:34
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
Quote:
Originally posted by Ian W.
but it gave me errors based on file size. any ideas?
what were the errors?
copy/paste em, and we can help better
__________________
Brandon Martus
e-mail
Reply With Quote
  #12   Spotlight this post!  
Unread 11-09-2002, 15:14
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
before it gave me error codes 1 and 2 for uploading files, now it just displays a blank screen and does nothing. i'm not sure why. maybe you guys have an idea?
__________________
AIM --> Woloi
Email --> ian@woloschin.com
Reply With Quote
  #13   Spotlight this post!  
Unread 11-09-2002, 16:32
DanL DanL is offline
Crusty Mentor
FRC #0097
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Somerville, MA
Posts: 682
DanL is just really niceDanL is just really niceDanL is just really niceDanL is just really niceDanL is just really nice
Send a message via AIM to DanL
Probably cause the username/password don't match and it was a 5-minute coding job so there's nothing in the code to tell you that, so nothing happens. Try changing the first few lines of the PHP to this:

PHP Code:
if ($user != "ian"  ||  $pw != "is_hot") {
   echo 
"Username and Password don't match.  Hit back and try again.";
   exit();

__________________
Dan L
Team 97 Mentor
Software Engineer, Vecna Technologies
Reply With Quote
  #14   Spotlight this post!  
Unread 15-09-2002, 11:31
Trashed20's Avatar
Trashed20 Trashed20 is offline
Boom, Shawalala Boom!
#0862 (PCEP Lighting)
 
Join Date: Jan 2002
Location: Canton, MI
Posts: 528
Trashed20 will become famous soon enough
Send a message via AIM to Trashed20
Quote:
Originally posted by Ian W.
before it gave me error codes 1 and 2 for uploading files, now it just displays a blank screen and does nothing. i'm not sure why. maybe you guys have an idea?
if you are still having problems try checking your php.ini file and the max file size argument. The max file size thing in the input is just an advisement, while the one in the php.ini file is the law, it can't be bigger than that, no matter what.

p.s. thanks to the people that posted this script, i wanted to do the same thing, and it was really easy to intregrate into my current user/login system thanks
__________________
Where has all the fun gone?
Reply With Quote
  #15   Spotlight this post!  
Unread 15-09-2002, 15:03
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
where is the php.ini file? i saw it mentioned, but i couldn't find it anywhere.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File Sharing and Revision Tracking Madison FIRST-related Organizations 14 04-06-2003 18:01
php vs. perl Jack Website Design/Showcase 20 29-12-2002 17:01
Dashv2.ocx dependency file now available archiver 2000 0 23-06-2002 22:00
What's better, PERL/cgi or PHP/my_sql? mikefrei Programming 10 27-05-2002 22:50
Improving PBASIC: Request for Comments Greg Ross Programming 19 16-02-2002 22:14


All times are GMT -5. The time now is 06:00.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi