FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Uploader not working.





ALostSoul
Code:

Code:
<?php
if ( !isset($_FILES['data']['name']) || $_FILES['data']['name'] == "") {
die('No input file specified. Please go back and select a file to upload.');
}
$max_filesize = 209715200; //max file size 200mb
$upload_path = '/uploads/'; //upload path
$filetype = array('text/plain','image/jpg,'image/png','image/gif','image/bmp','application/octet-stream','application/x-sdlc','image/jpeg','audio/mpeg','image/pjpeg','audio/mpeg','application/zip','audio/x-wav','video/mpeg');
if ($_FILES['data']['size'] > $max_filesize) {
die('Your filesize is too large. Please make your file size smaller than ' . $max_filesize . ' bytes.');
}
if (!in_array($_FILES['data']['type'], $filetype)) {
$i = 0;
$count = count($filetype);
$filetype_msg = '';
while ($i <= $count) {
$filetype_msg .= " ".$filetype[$i].",";
$i++;
}
die('Sorry, your file was not of the ' . $filetype_msg . ' mimetype (yours was ' . $_FILES['data']['type'] . ').');
}
$copy_to = $_SERVER['DOCUMENT_ROOT'] . $upload_path . $_FILES['data']['name'];
$upload = move_uploaded_file($_FILES['data']['tmp_name'], $copy_to);
if (!$upload) {
die('Sorry, your file could not be uploaded.');
}
echo 'Your file has been uploaded. You can access it by going to http://www.cyberinfections.frih.net/uploads/yourfilename.ext';
?>
PatTheGreat42
What, specifically, happens when you try to use this script? What error messages do you get, or does the next page just never load? Such things are helpful in debugging.

Also, have you double checked that your server allows for uploads?
Azmo
also make sure to check the path where u upload it, some servers require that u link the folder al the way from the root..
ALostSoul
It says something along the lines of "Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/alostsou/domains/cyberinfections.frih.net/public_html/upload.php on line 7"

I don't know where I'm going wrong though.
ALostSoul
SHIT: I know what I did wrong.
i forgot to put a quote after a file type

I had
Code:

$filetype = array('text/plain,'image/jpg','image/png','image/gif','image/bmp','application/octet-stream','application/x-sdlc','image/jpeg','audio/mpeg','image/pjpeg','audio/mpeg','application/zip','audio/x-wav','video/mpeg');


shoulda been

Code:

$filetype = array('text/plain','image/jpg','image/png','image/gif','image/bmp','application/octet-stream','application/x-sdlc','image/jpeg','audio/mpeg','image/pjpeg','audio/mpeg','application/zip','audio/x-wav','video/mpeg');
Related topics
My Subdomain still not working :(
File/Image uploader
site not working
My subdmain seems to be not working.
phpBB Not Working
[RESOLVED] Cpanel not working?
please provide feedback for http://sanghvitrades.frihost.net
[RESOLVED] Mailing list not working
domain name not working
[RESOLVED] trying to host a .com.au domain! help found!
Deleted public_html
Working with a Designer
Password Not Working
Domain stoped working
MySQL Masters Binary Logs & Replication?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.