mike12255 Posted January 21, 2011 Share Posted January 21, 2011 Im trying to use a file upload script i found here: http://www.phptoys.com/e107_plugins/content/content.php?content.39 and everything says it works but the file deosnt upload and i get the following in the error log: [20-Jan-2011 20:02:42] PHP Fatal error: Call to a member function Get() on a non-object in /home/mikeh/public_html/test/uploader.php on line 33 [20-Jan-2011 20:03:48] PHP Fatal error: Call to a member function Get() on a non-object in /home/mikeh/public_html/test/uploader.php on line 33 here is some info copied from my hostgator cpanel: Home Directory: /home/mikeh Operating System: Linux CentOS below is the entire source code: <?php /************************************************* * Micro Upload * * Version: 0.1 * Date: 2006-10-27 * * Usage: * Set the uploadLocation variable to the directory * where you want to store the uploaded files. * Use the version which is relevenat to your server OS. * ****************************************************/ //Windows way //$uploadLocation = "/home/mikeh/public_html/test"; //Unix, Linux way $uploadLocation = "/home/mikeh/public_html/test/"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>MicroPing domain status checker</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div id="caption">UPLOAD FILE</div> <div id="icon"> </div> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="fileForm" id="fileForm" enctype="multipart/form-data"> File to upload:<center> <table> <tr><td><input name="upfile" type="file" size="36"></td></tr> <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Upload"></td></tr> </table></center> </form> <?php if (isset($_POST['submitBtn'])){ ?> <div id="caption">RESULT</div> <div id="icon2"> </div> <div id="result"> <table width="100%"> <?php $target_path = $uploadLocation . basename( $_FILES['upfile']['name']); //die($target_path); if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) { echo "The file: ". basename( $_FILES['upfile']['name']). " has been uploaded!"; } else{ echo "There was an error uploading the file, please try again!"; } ?> </table> </div> <?php } ?> <div> </body> Edit: can be seen/tested at: http://cnotes.ca/test/microUpload.php Quote Link to comment https://forums.phpfreaks.com/topic/225145-file-uploading-says-it-works-but-doesnt/ Share on other sites More sharing options...
inversesoft123 Posted January 21, 2011 Share Posted January 21, 2011 I uploaded file named 19.jpg successfully on your site.. But this uploading script is highly unsafe for open use. any one can upload malware on your site. Quote Link to comment https://forums.phpfreaks.com/topic/225145-file-uploading-says-it-works-but-doesnt/#findComment-1162832 Share on other sites More sharing options...
PFMaBiSmAd Posted January 21, 2011 Share Posted January 21, 2011 The code and the URL to your site that you posted doesn't match the code and the filename mentioned in the error message. It will be a little hard to actually help you without the actual code/file that the error message indicates the problem is occurring in. Quote Link to comment https://forums.phpfreaks.com/topic/225145-file-uploading-says-it-works-but-doesnt/#findComment-1162834 Share on other sites More sharing options...
mike12255 Posted January 21, 2011 Author Share Posted January 21, 2011 The code and the URL to your site that you posted doesn't match the code and the filename mentioned in the error message. It will be a little hard to actually help you without the actual code/file that the error message indicates the problem is occurring in. I always miss the little things.. turns out that error log was from a previous test i tried. This works fine my ftp client just was not updating properly thanks for the input everyone. Quote Link to comment https://forums.phpfreaks.com/topic/225145-file-uploading-says-it-works-but-doesnt/#findComment-1162836 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.