zubrag.com
Free php and cpanel scripts to automate your daily routine

Free PHP Scripts :: File Upload Form

Simple file upload form for your site.

Features:
  • Limit file types available for upload
  • Maximum file size validation
  • Can rename file after upload to avoid URL guessing
  • Log of uploads can be saved in MySql database. Log includes Filename, file size, IP of the user, date of upload



Download File Upload Form


Comments

Michael December 6, 2007
Dude. Sweet.
Diego January 21, 2008
"Can rename file after upload to avoid URL guessing"

How do i make sure the file ending is not bigger than 10 characters? =/
m February 25, 2008
thank you very much! Very helpful!
April 22, 2008
if i wanted to upload files to "SITENAME.110mb.com"

what do i change???
i've got the username and pwd
jegonus [anti-spam] yahoo.com May 21, 2008
nope. doesn't work.
Chinmayee May 25, 2008
hey it's just working fabulous....
thank you very very much for providing this script for free...
actually it's priceless for the developers...
thanks again..
mono gram July 2, 2008
This is somthing that is rare to come accross that you share your stuff and thanks again
orsz July 13, 2008
it doesnt work for me:

405 Method Not Allowed
This type request is not allowed!
September 2, 2008
that's because you can limit specific file types
October 8, 2008
I got the dreaded 405 error and wondered what was up... then I noticed that no action is defined in the example HTML. So I changed it to the following and the 405 was gone:

<form action="file-upload.php" method="post" enctype="multipart/form-data">
designer.steiner [anti-spam] yahoo.com October 30, 2008
How do I get this uploader to send the files to "my" email account?
dipus November 20, 2008
doesn't work.. can you help? it makes nothing. no error, no upload..
Nico November 25, 2008
Yeah... It doesn't work!
LM4041 December 1, 2008
The original HTML file does not work (No reference to the PHP uploader file.

Correct as follows:
Original
<form method="post" enctype="multipart/form-data">

Updated
<form enctype="multipart/form-data" action="file-upload.php" method="POST">
December 11, 2008
It didn't work for me at first. After messing with it I figured out that the user has to load the php file first. Not the HTML.
kyle March 27, 2009
I get this error when trying to use the script, i've changed the folder permissions, but now im stuck, any ideas??
kyle March 27, 2009
The server encountered an unexpected condition which prevented it from fulfilling the request.
The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log.
JP April 2, 2009
Very nice script. Works like a charm :)

I have one questions, is it possible to add a function that resizes the image to a predefined width and/or height, but respecting aspect ratio?

I'm a php n00b and _tried_ to solve this but nothing works. Did any of you get that to work?
david [anti-spam] aquafields.com April 12, 2009
It Goes! Thanks!
I've tried for many hours to replicate PHPForms that worked on many of my sites but never on the one it was needed most! This worked instantly.
mjlomenzo [anti-spam] mountainside.org April 14, 2009
Destination folder does not exist or no permissions to see it.... what do I do here?
mjlomenzo [anti-spam] mountainside.org April 14, 2009
PS I even tried setting the permissions to 777
snkhwazi [anti-spam] yahoo.co.uk April 16, 2009
It works brilliantly, tryna amend it to make multiple file uploads!!!
PrimiCaps April 21, 2009
hello. this script is very useful. :) although, I wanna know if can we call for the uploaded file's name after it was uploaded??
April 23, 2009
You request the php file not the html file. Look at the script again. the script calls the html fille
dayne April 24, 2009
hehehe
cathy [anti-spam] spiderbytes.co.za May 20, 2009
I would like to know what variable I need to upload to the databse in order to call for the image. Can anyone help me?
nareshkumar_R [anti-spam] spanservices.com July 31, 2009
hi ra, pls download this file
Ajibolaolayanju [anti-spam] ymail.com September 9, 2009
I does it works i mean the upload php
September 15, 2009
It works perfectly. Although it'd be great to have a progress bar. Useful for large files and impatient clients
nickweb [anti-spam] otenet.gr September 29, 2009
Please enter (f78c1b3a) into the box
nxnx October 2, 2009
thanx..
but
how to rename the filename.
rudiwidayatna [anti-spam] ymail.com October 7, 2009
Thanks....
but how can i do to use this files in blogger? and where is the files upload by user is storage...?
October 21, 2009
thank you so much for your php script, really helps.
October 21, 2009
jo
thanks a lot
dominik October 30, 2009
i ryl like it
is there a version with a upload-funktion?
Thanks....<br> November 25, 2009
Thanks........<br>
nitin December 12, 2009
i am getting the message could not upload file (6) what could be the reason for this
Cobalt-Phoenix December 21, 2009
Hey, great script! I did notice that the files renamed themselves to random characters. If anyone is interested, to fix this, simply take out the line where it says

if (RENAME_FILE) {
$dest_filename = md5(uniqid(rand(), true)) . '.' . $file_ext;
}

However, keep this intact.

$dest_filename = $filename;

This will keep the original filename without the random rename.
I don't know about anyone else, but I tend to be picky about filenames. :p

Thank you for providing this script! It's very useful!
RiffThirteen January 13, 2010
Worked perfectly. But what do I need to change if I want to submit information about the image into the database?
nancy January 30, 2010
nice script. didn't work in windows xp till i gave it the full path c:/... (not \) and it worked like a charm.Also load the php file and not just double click on the html
thanks
Mazhar February 3, 2010
Hi Friends,

When i Upload the file by click Upload Button then it saves file-Upload.php file rahter then i select any other file(like Doc,txt etc.). Can Anyone give me idea to save the file which i have selected from filedialog.
ndiane2002 [anti-spam] hotmail.com February 13, 2010
Hi friends,

I am new in webdisign (using dreamwever), I have downloaded a upload script but don't know how to put it on my web site.

could anyone tell me how to do this?

thanks in advance
k
jessicajonnie [anti-spam] gmail.com February 24, 2010
Great script! How do I get it to email an alert notification upon sucessful upload?
March 3, 2010
GREAT SCRIPT!
I am sending the file info to MySql database, renaming the file and I have it set up to email the info on submit but I cant figure out how to receive the renamed file name instead of the original file name. Thanks in advance for any help. ET
vama97 [anti-spam] yahoo.com March 11, 2010
Can anyone tell me how do I get it to my email ?
Esmeralda March 16, 2010
it works like magic

nice job!
March 22, 2010
Brilliant! noted the part to load .php form first.
HASYARY [anti-spam] GMAIL.COM April 13, 2010
MAKASIH ATAS INFONYA..
THANKS 4 ALL
charan315 [anti-spam] yahoo.com April 16, 2010
i tried many file upload codes but because of php timeout was 60sec non worked for large files only one code worked well, link 4 trial version.

http://softfiles.summoto.com/file/4897821/ElementIT.UltimateUploaderForPHP.zip
May 3, 2010
it would be nice to see a demo. thanx
ThatsGoodBusyBe July 19, 2010
Great script.Nice to have Mysql log the upload details.Trying to debug "Can't connect to database" error, but thanks for the script.Excellent.
webhoost [anti-spam] live.com August 15, 2010
Hi i have aupload form in my website and people upload songs. who can i make when people upload songs to change title and to be my site.com and name of song????? or how can i change artist album or other
October 9, 2010
hi, great script, but what is it that i put in "destination folder"? ie. do i use the full http:// address or is it just a folder it is looking for? thanks in advance
October 14, 2010
guys,
please help on how to have the validation script in php.."ABC1232010" Filename format would be like that, once uploaded same FILEname format should be uploaded likewise its not uploaded..how to apply that..please help thanks
KozmaneNabi October 18, 2010
Hey Guys,

I have a Free PHP uploader for you :D

here you can download it or sell your php codes instant.

http://www.devharbor.com/loaders-and-uploaders/288-phUPLOADER-v1-2-for-Free.html

Enjoy !!!
sanghitan [anti-spam] gmail.com October 31, 2010
Lovely code man.
November 18, 2010
thank you !!!
Quietone January 19, 2011
Hi,

Looks like a great script. However, I am having problems making it work. [New to php] :(

From the following page I upload a .doc or a .docx file:
http://nanjing2011.org/proposal-submission/file-upload.html

and I get the same page back except the address in the location bar is now:
http://nanjing2011.org/proposal-submission/file-upload.php

and the file isn't uploaded.

Can you please help by letting me know what I am doing wrong.

Thank you.
gindif1 [anti-spam] hotmail.com February 14, 2011
May you please help,like to make file only for reading and how to upload and where?thx on advance
Elihu February 16, 2011
I get the message, "Destination folder does not exist or no permissions to see it." I have set permissions to 777.
aaron February 21, 2011
Quietone...

You have to load the .php not the .html. The .php file loads the .html within. opening just the .html does nothing because none of the php code is present. hope this helps
Mutor March 4, 2011
Nice Script
ddd March 5, 2011
Thanks you very much sir
alan March 29, 2011
help admin, wat i can do 2 make upload scripts on my wapsite..plz teach me step by step.tnx and more power
Chris May 27, 2011
Where is the script getting the $_FILES[filename][type]data from....if I upload a pdf the file type is application/pdf.....where is this application comming from.....i need to drop the application/ part and be just left with the extension
Thanks
Chris
Paul July 14, 2011
I'm no newcomer to Zubrag's scripts and I know I've done everything right and it "seems" to run through the script and then redirect me to the success page I made (after a reasonable amount of time depending on how big the file was) BUT... no file is showing in the destination folder.

Any ideas?
maddy September 2, 2011
its not working..provide more information on this..
September 23, 2011
great script.... thanks. I need an extra functionality, as upload the file to categorised folders based on input in a textbox. any help would be appreciated.
jennie September 30, 2011
How do i get the link to the file to be emailed to me when a user has uploaded it?
saul_winwood [anti-spam] hotmail.com November 7, 2011
Does anyone know how to turn this in to a multi file upload script please?
The Guig November 25, 2011
Work really well
myr January 19, 2012
thanks.. this is supper
vinaysgv2008 [anti-spam] gmail.com January 28, 2012
Hello may i know how to integrate this script in joomla article or module
mogi January 30, 2012
How do you make it so you can have more
upload forms on your site?
February 10, 2012
HOW TO ADD AND UPLOAD FILE
February 29, 2012
Nice, thanks. I spent a while looking around for a good example and this does just what I want.
Boris March 21, 2012
For those who want to implement in a page NOT calles 'upload-form.html' you should loor for an include around line 78, and change it to whatever page you are calling 'upload-form.PHP' from.

I created a variable and placed it in the configuration block so it'd be easier to implement in the future, if someone is interested just let me know!
izzy-k May 25, 2012
HOW do i call FILE UPLOAD on my DATABASE to display on my webpage
May 25, 2012
@ Boris "For those who want to implement in a page NOT calles 'upload-form.html' you should loor for an include around line 78, and change it to whatever page you are calling 'upload-form.PHP' from.

I created a variable and placed it in the configuration block so it'd be easier to implement in the future, if someone is interested just let me know!"
AM REALY INTRESTED PLS....
p.omkar000 [anti-spam] gmail.com June 4, 2012
Thx a lot!!!!!!
its very useful for me.
from:
http://www.iwebtechexpert.com
vishman June 13, 2012
Your service is wonderful....!thanks a lot man...!
jonjon September 23, 2012
if you use a table named something other than _uploads_log (and you are not using cpanel), make sure to change all instances of _uploads_log in the file-upload.php file
October 1, 2012
<h1>Xenotix XSS</h1>
hob34itt [anti-spam] live.com October 11, 2012
I can't get the destination folder tight. N9o one really helps on here or the forum where your question can be ignored by experts.
Mick October 29, 2012
Your script doesn't work and your instructions are lousy. Keep getting 'file not found' no matter what I do. Usual drive-by lack of geek's instructions from the open source world - "we're helping you - by taking an hour of your time pointlessly..."
ramiz Ansari November 19, 2012
destination folder not exist or no permission ......

how to fix this error !!!!????
ramiz ansari November 20, 2012
hey man thank you very much ....!
i was getting errors which i mentioned aboved but now all of them are fixed and your script is working like a rocket ...!

Thank You Very much
ramiz ansari November 21, 2012
one thing i wanted to ask is how to rename file with a variable from adressbar..

for example user is redirected to upload page by his name in adress bar

as: file-upload.php?name=ramiz

now i wanted the file save in to my directory as his name..

i used the code as:-


// destination filename, rename if set to
$dest_filename = $filename;
if (RENAME_FILE) {
$dest_filename = $_Get[name];
}

but it doesnt work please help me ...


ryan [anti-spam] apexlm.com February 13, 2013
destination folder not exist or no permission.

How do I get this to work
millermmdj [anti-spam] netzero.com March 18, 2013
I use the upload script which works great. But I want to send the filename to another php page through a variable. I don't know the filename variable to pass?
440Music August 23, 2013
I wanted to keep the file name and tried what Cobalt-Phoenx suggested and files would not upload.

// destination filename, rename if set to
$dest_filename = $filename;
if (RENAME_FILE) {
$dest_filename = md5(uniqid(rand(), true)) . '.' . $file_ext;
}
Where did I go wrong?

TBones
metalmaniax.440MUSIC.COM
440Music August 23, 2013
I figured where I went wrong.
// destination filename, rename if set to
$dest_filename = $filename;
Remove the following
// if (RENAME_FILE) {
$dest_filename = md5(uniqid(rand(), true)) . '.' . $file_ext;
}
//

I left the } in so it failed.

TBones
drdunc [anti-spam] aussiesnrg.com September 20, 2013
Awesome!, Thanks heaps!
Needed some minor tweaking of variables to fit in with my site but it works like a charm!
kappadocio [anti-spam] libero.it August 26, 2014
Good, it's very interesting.
I'm looking about a system to upload to (or more) different files in a form. Can i adapt this script?
N8scovell [anti-spam] gmail.com August 27, 2014
I was using your form but I keep getting the "Destination folder does not exist or no permissions to see it." How do I get my server to accept files?
neemroma [anti-spam] gmail.com October 9, 2014
plz help me smeone how to creat a chating site in taplap plz plz

Add Comment

!!! Comments posted here will not be answered. If you want to ask a question please post it on the forum.

E-mail or Name: Not required. Email will be protected from spammers

Comment: Please do not post unrelated comments

Anti-spam: Please enter (e98ec51c) into the box