Be a Supporter!
ButtheadMoto
ButtheadMoto
  • Member since: Apr. 10, 2001
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
uploading??? 2001-07-02 00:32:06 Reply

anyone know where i can learn to make a file upload section on my site???

i can use all the help i can get...
thanx

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to uploading??? 2001-07-02 04:03:44 Reply

At 7/2/01 12:32 AM, ButtheadMoto wrote: anyone know where i can learn to make a file upload section on my site???

i can use all the help i can get...
thanx

What resources you got? PHP? ASP? both?

ButtheadMoto
ButtheadMoto
  • Member since: Apr. 10, 2001
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to uploading??? 2001-07-02 16:25:19 Reply

At 7/2/01 04:03 AM, RichL wrote:
At 7/2/01 12:32 AM, ButtheadMoto wrote: anyone know where i can learn to make a file upload section on my site???

i can use all the help i can get...
thanx
What resources you got? PHP? ASP? both?

PHP

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to uploading??? 2001-07-02 17:13:41 Reply

At 7/2/01 04:25 PM, ButtheadMoto wrote:
At 7/2/01 04:03 AM, RichL wrote:
At 7/2/01 12:32 AM, ButtheadMoto wrote: anyone know where i can learn to make a file upload section on my site???

i can use all the help i can get...
thanx
What resources you got? PHP? ASP? both?
PHP

Great! check out http://www.hotscripts.com/Detailed/5701.html
Its a pre-made binary upload script..which would be easier to customise than to create yourself. ;)

liljim
liljim
  • Member since: Dec. 16, 1999
  • Offline.
Forum Stats
Staff
Level 28
Blank Slate
Response to uploading??? 2001-07-02 18:57:00 Reply

At 7/2/01 05:13 PM, RichL wrote: ..which would be easier to customise than to create yourself. ;)

Incorrect - as with all pre-written scripts, if you don't understand the syntax, you won't know what to correct when it goes wrong. Try looking at this tutorial for the very basics. There's a feature on the PHP site (which you can easily find by doing a quick search - "file upload" should do it).

ButtheadMoto
ButtheadMoto
  • Member since: Apr. 10, 2001
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to uploading??? 2001-07-02 20:07:12 Reply

At 7/2/01 06:57 PM, liljim wrote:
At 7/2/01 05:13 PM, RichL wrote: ..which would be easier to customise than to create yourself. ;)
Incorrect - as with all pre-written scripts, if you don't understand the syntax, you won't know what to correct when it goes wrong. Try looking at this tutorial for the very basics. There's a feature on the PHP site (which you can easily find by doing a quick search - "file upload" should do it).

thanx, i'll check those out...

Pecos
Pecos
  • Member since: Dec. 29, 1999
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to uploading??? 2001-07-03 08:04:25 Reply

At 7/2/01 05:13 PM, RichL wrote: Its a pre-made binary upload script..which would be easier to customise than to create yourself. ;)

And PHP CGI scripts are not binaries.

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to uploading??? 2001-07-03 12:31:12 Reply

Its a pre-made binary upload script..which would be easier to customise than to create yourself. ;)
And PHP CGI scripts are not binaries.

Take a look at the detailed page on the HotScripts link above. See the words "upload" and "in" and "B I N A R Y"? I was just looking for a script for him- this is what i found. (and the actual scripts arent binaries..i didnt say that. I said the scripts can upload in binary)

Pecos
Pecos
  • Member since: Dec. 29, 1999
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to uploading??? 2001-07-03 14:17:32 Reply

At 7/3/01 12:31 PM, RichL wrote:
Its a pre-made binary upload script..which would be easier to customise than to create yourself. ;)
And PHP CGI scripts are not binaries.
Take a look at the detailed page on the HotScripts link above. See the words "upload" and "in" and "B I N A R Y"? I was just looking for a script for him- this is what i found. (and the actual scripts arent binaries..i didnt say that. I said the scripts can upload in binary)

Look.. there is no such thing as a PHP CGI binary, you do NOT compile PHP code unless you're making a module. Just do not post here, seeing as you are a complete moron because you don't know what you're talking about yet you spit out random shit. Just go back to the General section of the BBS!

aladinsane
aladinsane
  • Member since: Jan. 17, 2000
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to uploading??? 2001-07-03 14:48:44 Reply

At 7/3/01 02:17 PM, MassiveBit wrote: Look.. there is no such thing as a PHP CGI binary, you do NOT compile PHP code unless you're making a module. Just do not post here, seeing as you are a complete moron because you don't know what you're talking about yet you spit out random shit. Just go back to the General section of the BBS!

Actually Rich knows what he's talking about here for once. When he said binary he was referring to the types of files that the script can upload not the script itself. Quote from description on HotScripts:

"This is a PHP script that allows you to store any binary to MySQL. You can put any images, zip, exe or whatever binary format into MySQL."

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to uploading??? 2001-07-03 15:05:51 Reply

Actually Rich knows what he's talking about here for once. When he said binary he was referring to the types of files that the script can upload not the script itself. Quote from description on HotScripts:

"This is a PHP script that allows you to store any binary to MySQL. You can put any images, zip, exe or whatever binary format into MySQL."

Thankyou. -about here for once- I think! I did say that..and i quote from my post before ". (and the actual scripts arent binaries..i didnt say that. I said the scripts can upload in binary)
". And MassiveB- dude, i was reading some other posts in this forum where you've replied to them- and in alot of them you swear, curse, and give decent people aload of shit. brighten up huh?

liljim
liljim
  • Member since: Dec. 16, 1999
  • Offline.
Forum Stats
Staff
Level 28
Blank Slate
Response to uploading??? 2001-07-03 19:19:59 Reply

At 7/3/01 02:48 PM, aladinsane wrote: Actually Rich knows what he's talking about here for once. When he said binary he was referring to the types of files that the script can upload not the script itself. Quote from description on HotScripts:

"This is a PHP script that allows you to store any binary to MySQL. You can put any images, zip, exe or whatever binary format into MySQL."

That might have been what he meant, but not what he wrote (which was "Its a pre-made binary upload script") - probably why MassiveBit commented on it.

Annnnywayyyy, one thing I would recommend to those who're wanting to create file upload scripts - create a generic set of functions in a file that you can include() (or require()) and invoke through the scripts you are using.

Pecos
Pecos
  • Member since: Dec. 29, 1999
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to uploading??? 2001-07-03 19:36:38 Reply

At 7/3/01 03:05 PM, RichL wrote:
Actually Rich knows what he's talking about here for once. When he said binary he was referring to the types of files that the script can upload not the script itself. Quote from description on HotScripts:

"This is a PHP script that allows you to store any binary to MySQL. You can put any images, zip, exe or whatever binary format into MySQL."
Thankyou. -about here for once- I think! I did say that..and i quote from my post before ". (and the actual scripts arent binaries..i didnt say that. I said the scripts can upload in binary)
". And MassiveB- dude, i was reading some other posts in this forum where you've replied to them- and in alot of them you swear, curse, and give decent people aload of shit. brighten up huh?

Yeah, the problem I had was with these comments:
"I said the scripts can upload in binary"
"Its a pre-made binary upload script"

Those statements to me meant that the scripts themselves were binaries, which they obviously aren't. So it was due to your lack of clarity of these descriptions that I said what I said.

Don't get mad, mister... I might curse a lot, but not nearly as much as a typical American. ;o)

RichL
RichL
  • Member since: Apr. 2, 2000
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to uploading??? 2001-07-04 06:13:39 Reply

Yeah, the problem I had was with these comments:
"I said the scripts can upload in binary"
"Its a pre-made binary upload script"

Those statements to me meant that the scripts themselves were binaries, which they obviously aren't. So it was due to your lack of clarity of these descriptions that I said what I said.

Don't get mad, mister... I might curse a lot, but not nearly as much as a typical American. ;o)

Oh ok- i apoligise for this, i didnt think i wrote that (as its not what i meant). I was just trying to help the guy who asked the question! i wanna be a first class programmer like you guys. group hug ;)

uploading???

Pecos
Pecos
  • Member since: Dec. 29, 1999
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to uploading??? 2001-07-05 13:53:32 Reply

At 7/4/01 06:13 AM, RichL wrote: Oh ok- i apoligise for this, i didnt think i wrote that (as its not what i meant). I was just trying to help the guy who asked the question! i wanna be a first class programmer like you guys. group hug ;)

Aww gosh darn.. you sweet bastard!

ButtheadMoto
ButtheadMoto
  • Member since: Apr. 10, 2001
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to uploading??? 2001-07-07 14:21:59 Reply

i can't get any scripts 2 work right. they all fail about half-way through.

liljim
liljim
  • Member since: Dec. 16, 1999
  • Offline.
Forum Stats
Staff
Level 28
Blank Slate
Response to uploading??? 2001-07-07 14:25:44 Reply

At 7/7/01 02:21 PM, ButtheadMoto wrote:
i can't get any scripts 2 work right. they all fail about half-way through.

1/. Post your code.
2/. Post a url.

:)

ButtheadMoto
ButtheadMoto
  • Member since: Apr. 10, 2001
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to uploading??? 2001-07-09 18:01:22 Reply

At 7/7/01 02:25 PM, liljim wrote:
At 7/7/01 02:21 PM, ButtheadMoto wrote:
i can't get any scripts 2 work right. they all fail about half-way through.
1/. Post your code.
2/. Post a url.

)

it wont let me post the code...
how do i do it?

liljim
liljim
  • Member since: Dec. 16, 1999
  • Offline.
Forum Stats
Staff
Level 28
Blank Slate
Response to uploading??? 2001-07-09 18:16:36 Reply

At 7/9/01 06:01 PM, ButtheadMoto wrote: it wont let me post the code...
how do i do it?

If you can't post it, then zip it up and link it.... That way we can look at the source code exactly as you've written it. Don't forget to hide any username / passwords in what you zip though.

ButtheadMoto
ButtheadMoto
  • Member since: Apr. 10, 2001
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to uploading??? 2001-07-09 20:00:37 Reply

At 7/9/01 06:16 PM, liljim wrote:
At 7/9/01 06:01 PM, ButtheadMoto wrote: it wont let me post the code...
how do i do it?
If you can't post it, then zip it up and link it.... That way we can look at the source code exactly as you've written it. Don't forget to hide any username / passwords in what you zip though.

the zip file is in this directory...
it include the source in .txt files & the actual .php files

ButtheadMoto
ButtheadMoto
  • Member since: Apr. 10, 2001
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to uploading??? 2001-07-10 00:45:31 Reply

At 7/9/01 08:00 PM, ButtheadMoto wrote:
At 7/9/01 06:16 PM, liljim wrote:
At 7/9/01 06:01 PM, ButtheadMoto wrote: it wont let me post the code...
how do i do it?
If you can't post it, then zip it up and link it.... That way we can look at the source code exactly as you've written it. Don't forget to hide any username / passwords in what you zip though.

the zip file is in this directory...
it include the source in .txt files & the actual .php files

the zip file isn't on my "actual site"...
it is just in my mainly file storage site...
just so you don't think the code is for angelfire, angelfire sucks when it comes to CGI, PHP, etc.

liljim
liljim
  • Member since: Dec. 16, 1999
  • Offline.
Forum Stats
Staff
Level 28
Blank Slate
Response to uploading??? 2001-07-10 06:43:55 Reply

OK, well firstly, you shouldn't have to specify a temp directory to upload to... The server should do that. Your script can be as simple as this (your function, re-written, together with another function that generates a new filename based on a timestamp).

function NewFileName($userfile_name) {
$newfile = time() . $userfile_name;
return $newfile;
}

function do_upload($userfile, $userfile_name, $userfile_size, $userfile_type) {

$new_file_name = NewFileName($userfile_name);

if (!@copy($userfile, "/path/to/desired/directory/" . $new_file_name)) {
return false;
} else {
return true;
}

}

Call it by using:

if (!do_upload($userfile, $userfile_name, $userfile_size, $userfile_type)) {
echo "Error uploading " . $userfile_name;
}

Of course, this doesn't specify what types of files you want, nor does it specify the max file size and ignore files that don't meet the criteria you want (though neither did your original script), but one thing at a time ;)