Important alert: (current site time 7/15/2013 10:05:37 AM EDT)
 

winzip icon

A File Uploader WITHOUT register_globals

Email
Submitted on: 6/8/2003 11:54:13 PM
By: Patrick Krecker  
Level: Intermediate
User Rating: By 9 Users
Compatibility: PHP 4.0
Views: 27629
(About the author)
 
     Uploads a file without needing register_globals. I found it very annoying that all the file upload scripts I've seen assume register_globals is On. So, I wrote a script that doesn't require register_globals and is compatable with PHP 4.2.0 and higher. Hope it helps you out!
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
8/14/2003 1:50:27 AMHackMan Curda

To what directory uploads the files???
(If this comment was disrespectful, please report it.)

 
8/14/2003 6:13:02 PMPatrick Krecker

See where it says copy($_FILES["filename"]["tmp_name"],"./".$_FILES["filename"]["name"])?

The first argument isn't important. The second one copies it to folder "./", or the current directory. To copy it to a different folder replace the dot with the folder name.
(If this comment was disrespectful, please report it.)

 
12/29/2003 5:32:31 PM

I also can't find the file, and I only had successful uploads with bitmap images so far... is this me or the script? are there any server-side scripts i have to have installed (does this have to run on a unix/linux server...)?

I have no idea how to make this work

thanks for any help!!!
(If this comment was disrespectful, please report it.)

 
10/21/2004 6:24:39 PMRichard T

probably not your fault... but when i run this script on nanoweb for windows (ive tried 2.1.1 and 2.2.5) it successfully uploads as many times as you want, but when you try to switch to another page on the website, no response... any idea why?
(If this comment was disrespectful, please report it.)

 
10/21/2004 6:40:22 PMPatrick Krecker

I'm not sure, but since you're not using Apache/PHP then I can only speculate. I'd say it's a bug with the PHP parser you're using.
(If this comment was disrespectful, please report it.)

 
5/23/2005 6:53:50 PMC.Smith

Exactly what I needed, works great!
(If this comment was disrespectful, please report it.)

 
6/20/2005 3:27:35 PMDucch

you can easily inject stuff into it.
no checks are done on the $_GET[] values.
(If this comment was disrespectful, please report it.)

 
11/11/2005 2:21:52 AMAmit

Hi, It works really great. But Whenever I try to upload a file of application format, it generate an error. Can you u tell me why it is like this and what should do to over come this bug ?
(If this comment was disrespectful, please report it.)

 
1/20/2006 9:46:31 PMEkremsky

Thanks for the code,it really works,but how can i change the upload size from 1 Mb to 100 Mb or 200 Mb?
(If this comment was disrespectful, please report it.)

 
7/8/2007 2:41:22 AMClint Floyd Monzon

Thanks for sharing this kind of code. It really helps me. Thanks Again.
(If this comment was disrespectful, please report it.)

 
8/12/2008 3:51:30 AM

its not easy to a normal people
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.