Closed Thread Icon

Topic awaiting preservation: Where is this variable getting set? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12367" title="Pages that link to Topic awaiting preservation: Where is this variable getting set? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Where is this variable getting set? <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-17-2002 18:06

Okay, realizing I've looked at this thing so long I'm going cross-eyed.... (and now, so has Emperor)

Working script
Source

Here is the (stupid) problem:

a) I can't, for the life of me, determine where $the_file_type is getting set. Yet it works.

Some info on the script.
I have it set to only allow .jpg, .gif, and .pdf. If I don't specify a $type in the URL, it will take ANY of these three. If I specify $type, it will ONLY take that type. The script then moves and renames the file to $type/$id.$ext

Everything works fine. Except I can't see where that damned variable is getting set. 90% of this is my code, but 10% is reverse-engineered, and I must be overlooking something. I'm just cleaning up the code a little and adding some features before I roll this into a content management system.

Thanks!


bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-17-2002 19:23

Pugz, it's a magic variable that gets set automatically when you upload a file

PHP has a way of handling files where whatever the name is of the input field is you get 3 magic variables automatically set

the_file_size
the_file_type
the_file_name

(for clarity sake if anyone else is watching, it's what ever you name the file field then "_size" pugz named it "the_file" so he gets "the_file_type")

This method is a bit deprecated, you should access these vars like so $HTTP_POST_FILES['the_file']['type']




.:[ Never resist a perfect moment ]:.

[This message has been edited by bitdamaged (edited 08-17-2002).]

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-22-2002 17:08

Ahh...ok. So I'm not going crazy (or at least crazier).

Thanks!

« BackwardsOnwards »

Show Forum Drop Down Menu