View previous topic :: View next topic |
Author |
Message |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Apr 16, 2004 11:51 am Post subject: ::File Uploader:: Upload Script |
|
|
Edit: You can find this script at http://php.trustabyss.com
Last edited by TRUSTAbyss on Thu Mar 24, 2005 9:43 am; edited 1 time in total |
|
Back to top |
|
 |
adrenaline786 -
Joined: 09 Apr 2004 Posts: 13
|
Posted: Fri Apr 16, 2004 8:13 pm Post subject: |
|
|
will this give me the damn ERROR 200 OK. messge?
great script but why wont it let me upload .mp3's even after i put it in the script? |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Apr 17, 2004 5:00 am Post subject: |
|
|
You must have set it up wrong , what are your settings and no
this script will not display a error 200 as long as Register Globals
is turned on in your php.ini file , read the ReadMe file.
Their is also a 1 MB limit for each upload
please refer to the ReadMe.txt file. |
|
Back to top |
|
 |
adrenaline786 -
Joined: 09 Apr 2004 Posts: 13
|
Posted: Sat Apr 17, 2004 7:39 pm Post subject: |
|
|
TRUSTpunk wrote: | You must have set it up wrong , what are your settings and no
this script will not display a error 200 as long as Register Globals
is turned on in your php.ini file , read the ReadMe file.
Their is also a 1 MB limit for each upload
please refer to the ReadMe.txt file. |
everything is working fine except for uploading .mp3's it doesnt work ill paste my config in here
<html>
<head>
<title>File Uploader</title>
</head>
<body bgcolor="silver">
<?php
$max_size = "100000000000048576"; // Maximum File Size (In Bytes)
$extensions = ".gif$|.jpg$|.mp3$|.wma$|.mpeg$|.bmp$"; // Allowed File Extensions
if ($file) {
if ($file_size <= $max_size) {
if (ereg($extensions , $file_name)) {
print "File name: $file_name<p>\n";
print "File size: $file_size<p>\n";
if (copy ($file, "files_uploaded/$file_name")) {
print "<font color=\"blue\" font size=\"3\">Your file was successfully uploaded !</font><p>\n";
}else{
print "<font color=\"red\" font size=\"3\">Your File could not be uploaded!</font></P>\n";
}
}else{
print "<font color=\"red\" font size=\"3\">Bad File Extension (GIF & JPG) Only!</font><p>\n";
}
}else{
print "<font color=\"red\" font size=\"3\">The File Size is Too Big!</font><p>\n";
}
unlink ($file);
}
print "Upload a File to the server:
<br><form action='index.php' method='post' enctype='multipart/form-data'>
<input type='file' name='file'><br><input type='submit' value='Upload'><br>
<hr>Files Allowed: GIF and JPG <br> Max File Size: Alot of MB";
?>
</body>
</html>
as you see i have set it up correctly i think and the file size is fine so please help ive been looking for a uploading script that does mp3's for a while |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Apr 17, 2004 10:36 pm Post subject: |
|
|
try changing | to || to seperate extensions because someone
told me a while back that that could cause problems and that
|| is the right way to use it , so use ||.mp3$ |
|
Back to top |
|
 |
adrenaline786 -
Joined: 09 Apr 2004 Posts: 13
|
Posted: Sat Apr 17, 2004 11:51 pm Post subject: |
|
|
tried it and it doesnt work have you tried uploading mp3's?
im going to pm you my site for uploading and you'll see what happens |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Apr 18, 2004 1:43 am Post subject: |
|
|
I see that Register Globals is on because it works but
make sure the max upload in your php.ini is set to = 0
Edit: What version of php are you using ?
I use PHP 4.3.6 , it just came out
php.ini
Code: | ;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = C:\Program Files\PHP\uploadtemp ; temporary directory for HTTP uploaded files (will use system default if not specified)
; Maximum allowed size for uploaded files.
upload_max_filesize = 0 |
|
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sun Apr 18, 2004 3:21 am Post subject: |
|
|
Also, change the CGI Timeout in the Abyss Console [to a larger value]. _________________ Bienvenidos! |
|
Back to top |
 |
 |
adrenaline786 -
Joined: 09 Apr 2004 Posts: 13
|
Posted: Sun Apr 18, 2004 6:22 am Post subject: |
|
|
TRUSTpunk wrote: | I see that Register Globals is on because it works but
make sure the max upload in your php.ini is set to = 0
Edit: What version of php are you using ?
I use PHP 4.3.6 , it just came out
php.ini
Code: | ;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = C:\Program Files\PHP\uploadtemp ; temporary directory for HTTP uploaded files (will use system default if not specified)
; Maximum allowed size for uploaded files.
upload_max_filesize = 0 |
|
thanks alot its working now! oh yea and you now when you said change | to || that does NOT work i tried it and it didnt you have to keep | |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Apr 18, 2004 6:24 am Post subject: |
|
|
Than the person who told me that doesn't
know that much PHP as I do , Later!
Enjoy the script and thank you
for using it on your web page ! 8) |
|
Back to top |
|
 |
|