Jump to content

Recommended Posts

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 ?
 
 

 

Link to comment
https://forums.phpfreaks.com/topic/293376-how-to-upload-file-in-php-mvc-framework/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.