PranAher Posted December 27, 2014 Share Posted December 27, 2014 I am new to mvc , I have down loaded frame work from http://www.php-mini.com //CONTROLLER public function upload_slider(){ if(isset($_POST['upload'])) { $slider_model = $this -> loadmodel('slidermodel'); $slider = $slider_model -> upload_slider( $_FILES['IMAGE_PATH'], $_POST['title'], $_POST['alt'] ); } //MODEL //slidermodel public function upload_slider($IMAGE_PATH = '' ,$title ='',$alt='' ){ $uploaddir = "slider/"; $new_file_name = explode(".", $IMAGE_PATH['name']); $new_file_name = $new_file_name[count($new_file_name) - 1]; $new_file_name = uniqid(). "." .$new_file_name; $uploadfile = $uploaddir . basename($new_file_name); move_uploaded_file($IMAGE_PATH['tmp_name'],$uploadfile); } I am failing to upload image can somone help me ? Quote Link to comment https://forums.phpfreaks.com/topic/293376-how-to-upload-file-in-php-mvc-framework/ Share on other sites More sharing options...
ElectricOwl Posted January 2, 2015 Share Posted January 2, 2015 What errors are you getting when you run the code? Ensure (in development) that error reporting is on so you can debug the code rapidly. <?php error_reporting(E_ALL); ini_set('display_errors', 1); ... Additionally, seriously consider using an IDE like Netbeans for writing your code. The built in PHP Linter will make you aware of simple typos in the code. As for your code.. * Can the script write to the path 'slider/'? * Are you following an example from the php-mini framework pages? Cheers, Ian Quote Link to comment https://forums.phpfreaks.com/topic/293376-how-to-upload-file-in-php-mvc-framework/#findComment-1501518 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.