View previous topic :: View next topic |
Author |
Message |
os17fan -
Joined: 21 Mar 2003 Posts: 531 Location: USA
|
Posted: Tue Oct 21, 2003 7:51 am Post subject: Upload PHP Script! |
|
|
-------------------------------------------------------------------------------------
From my previous topic I asked if someone can pin point my upload error and so I did some research and found out a few missing things that I forgot to add.
Here's my upload script , if you want a Live demo go here
http://www.offspringvideos.com/live/FileUpload.php , I wrote this script my self using my PHP book by Larry Ullman.
-------------------------------------------------------------------------------------
Read at the bottom for installing this PHP upload script , it sure is better than the ones I have seen on the net.
Code: | <html>
<head>
<title>::ULTIMATE OFFSPRING:: File Upload</title>
</head>
<body bgcolor="silver">
<?php
if ($file){
print ("File name: $file_name<p>\n");
print ("File size: $file_size (Bytes)<p>\n");
if (copy ($file, "C:\Upload_Path/$file_name")){
print ("<font color=\"blue\" font size=\"2\">Your file was uploaded!<p>\n");
}else{
print ("<font color=\"red\" font size=\"2\">Your file was not uploaded.<font color=\"black\" font size=\"2\"> Click on Browse<p>\n");
}
unlink ($file);
}
print ("<hr>");
print ("<font color=\"black\" font size=\"2\">Upload a file to the server:\n");
print ("<form action=\"FileUpload.php\" method=\"post\" enctype=\"multipart/form-data\">\n");
print ("File <input type=\"file\" name=\"file\" size=\"20\"><br>\n");
print ("<input type=\"submit\" value=\"Upload\"></form>\n");
print ("Max File Size: 15 MB");
?>
</html>
</body>
|
Description: This script is very unique because their is a silver background and it has a seperator in between the upload form so when a upload is complete, you will see a message in blue , when a upload fails , you will see it in red. At the top is where the stats of the file are shown.
Installing: This is very easy to install , just open a text editor and copy the code and paste it in your text editor and save it as FileUpload.php and open that file and edit the path to the FileUpload.php file on your server and go to C:\windows and find the file php.ini because you have to set the upload limit and your done. Just browse to
http://your-site.com/php_path/FileUpload.php
Edit FileUpload.php: C:\Upload_Path/$file_name (To your upload folder)
Edit FileUpload.php: Max File Size: 15 MB (To the number your's is set to)
I think you will find this upload script better than the ones I have seen on hotscripts.com , I created this because they hardly support upload scripts. Enjoy my PHP script! 8) _________________ This web server is the best !
Last edited by os17fan on Wed Oct 22, 2003 1:38 am; edited 2 times in total |
|
Back to top |
|
|
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Wed Oct 22, 2003 12:45 am Post subject: |
|
|
Might want to add a few security features to that before you call it better than anything... No offence intended! :) |
|
Back to top |
|
|
os17fan -
Joined: 21 Mar 2003 Posts: 531 Location: USA
|
Posted: Wed Oct 22, 2003 1:29 am Post subject: |
|
|
Im working on that ! :oops: _________________ This web server is the best ! |
|
Back to top |
|
|
lestat -
Joined: 15 Sep 2003 Posts: 130 Location: GREEN BAY
|
Posted: Tue Feb 10, 2004 6:53 pm Post subject: |
|
|
"Your file was not uploaded"
What am I doing wrong?
Quote: | if (copy ($file, "http://vlp/php/uploadtemp/$file_name")) |
|
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Feb 10, 2004 6:58 pm Post subject: |
|
|
its supposed to be a local path and dude , you found my PHP
script , now I can find out whats going on when I re wrote it,
thank you so much! 8)
Edit: It finally works! :D |
|
Back to top |
|
|
lestat -
Joined: 15 Sep 2003 Posts: 130 Location: GREEN BAY
|
Posted: Tue Feb 10, 2004 8:47 pm Post subject: |
|
|
It still wont upload. Get the same reply message that it didn't. I think it's something with the server settings. Any idea? |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Feb 10, 2004 9:23 pm Post subject: |
|
|
it won't work because your using a http:// , it should
be a local path such as C:\uploads :? |
|
Back to top |
|
|
|