PDF is not getting uploaded in my folder

I have school management software. When i click on add teachers - i am uploading pdf file
same way when i am clicking on edit teacher i am adding pdf file. message is showing proper. but when i click on view teacher tab not showing pdf. I have checked in my upload folder, pdf is not there.

function edit n create, written code

if (Input::hasFile('teachermemo_1')) {
			$fileInstance3 = Input::file('teachermemo_1');
			$newFileName3= "teacher_memo_1_".$User->id.".pdf";
			$file_memo_1 = $fileInstance3->move('uploads/marksheetPDFUpload/',$newFileName3);

			$User->teachermemo_1 = $newFileName3;
		}
	
	$User->save();

function view

";
				if($data['teachermemo_1'] != "") {
					$return['content'] .= "<td><a href='uploads/marksheetPDFUpload/".$data['teachermemo_1']."' target='_blank' >View  Memo 1</a></td>";
				} else {
					$return['content'] .= "<td>Memo not uploaded...</td>";
				}

				$return['content'] .= "</tr>

Please show your file upload code. Are you using a platform? This code is not standard PHP code.
It appears that you are using some code to create an object to handle the file and posting of the form data.
Looks like you named this “Input”. Show us that class.

Thank You for your reply…

public function create(){
	if(User::where('username',trim(Input::get('username')))->count() > 0){
		return $this->panelInit->apiOutput(false,$this->panelInit->language['addTeacher'],$this->panelInit->language['usernameUsed']);
	}
	if(User::where('email',Input::get('email'))->count() > 0){
		return $this->panelInit->apiOutput(false,$this->panelInit->language['addTeacher'],$this->panelInit->language['mailUsed']);
	}
	$User = new User();
	$User->username = Input::get('username');
	$User->email = Input::get('email');
	$User->fullName = Input::get('fullName');
	$User->password = Hash::make(Input::get('password'));
	$User->role = "teacher";
	$User->gender = Input::get('gender');
	$User->address = Input::get('address');
	$User->phoneNo = Input::get('phoneNo');
                                $User->Designation = Input::get('Designation');
	$User->mobileNo = Input::get('mobileNo');
	$User->transport = Input::get('transport');
	$User->isLeaderBoard = "";
	if(Input::get('birthday') != ""){
		$User->birthday = $this->panelInit->dateToUnix(Input::get('birthday'));
	}
	$User->save();

	if (Input::hasFile('photo')) {
		$fileInstance = Input::file('photo');
		$newFileName = "profile_".$User->id.".jpg";
		$file = $fileInstance->move('uploads/profile/',$newFileName);

		$User->photo = "profile_".$User->id.".jpg";
		$User->save();
	}
	
		if (Input::hasFile('teachermemo_1')) {
			$fileInstance3 = Input::file('teachermemo_1');
			$newFileName3= "teacher_memo_1_".$User->id.".pdf";
			$file_memo_1 = $fileInstance3->move('uploads/marksheetPDFUpload/',$newFileName3);

			$User->teachermemo_1 = $newFileName3;
			$User->save();	
		}

			
		
		
	
	
	

	return $this->panelInit->apiOutput(true,$this->panelInit->language['addTeacher'],$this->panelInit->language['teacherCreated'],$User->toArray());
}

function profile($id){
$data = User::where(‘role’,‘teacher’)->where(‘id’,$id)->first()->toArray();
$data[‘birthday’] = $this->panelInit->unixToDate($data[‘birthday’]);

	$return = array();
	$return['title'] = $data['fullName']." ".$this->panelInit->language['Profile'];



	$return['content'] = "<div class='text-center'>";

	$return['content'] .= "<img alt='".$data['fullName']."' class='user-image img-circle' style='width:70px; height:70px;' src='dashboard/profileImage/".$data['id']."'>";

	$return['content'] .= "</div>";

	$return['content'] .= "<h4>".$this->panelInit->language['teacherInfo']."</h4>";
	

	$return['content'] .= "<table class='table table-bordered'><tbody>
                      <tr>
                          <td>".$this->panelInit->language['FullName']."</td>
                          <td>".$data['fullName']."</td>
                      </tr>
                      <tr>
                          <td>Gender</td>
                          <td>".$data['gender']."</td>
                      </tr>
                      <tr>
                          <td>".$this->panelInit->language['username']."</td>
                          <td>".$data['username']."</td>
                      </tr>
                      <tr>
                          <td>Designation</td>
                          <td>".$data['Designation']."</td>
                      </tr>
                        <tr>
                          <td>DOB</td>
                          <td>".$data['birthday']."</td>
                      </tr>
                       <tr>
                          <td>Mobile No</td>
                          <td>".$data['mobileNo']."</td>
                      </tr>
                       <tr>
                          <td>Alternate Phone No</td>
                          <td>".$data['phoneNo']."</td>
                      </tr>
                      <tr>
                          <td>Address</td>
                          <td>".$data['address']."</td>
                      </tr>
                      
                      <tr>
                      
                      
                      
                      
                      <table>
			<tbody>
				<tr>";

				if($data['teachermemo_1'] != "") {
					$return['content'] .= "<td><a href='uploads/marksheetPDFUpload/".$data['teachermemo_1']."' target='_blank' >View  Memo 1</a></td>";
				} else {
					$return['content'] .= "<td>Memo not uploaded...</td>";
				}

				$return['content'] .= "</tr>
			</tbody>
		</table>

If you can write …

Sorry, Leena, perhaps I was not clear…

You need to show us your upload and moving code. You are using “CLASSES”. You have one named Input and one named User. It appears your upload code is in the “Input” class. Can you show us your class named “Input”? In there is the real code behind all of your class calls. See this section:

		if (Input::hasFile('teachermemo_1')) {
			$fileInstance3 = Input::file('teachermemo_1');
			$newFileName3= "teacher_memo_1_".$User->id.".pdf";
			$file_memo_1 = $fileInstance3->move('uploads/marksheetPDFUpload/',$newFileName3);

			$User->teachermemo_1 = $newFileName3;
			$User->save();	
		}

In this section you use Input(class)::file(routine in the class) along with the ::hasFile, too.
My guess is that one of those class routines are failing.

But, another possible problem is that the filename for the new memo is not being corrected in the right
format. Do you know how to debug code? There are several ways to debug this. One way that might
work for you is to write the data to a temporary text file and view it to see what was created. It is very
easy to do that. But, show us your class for Input and we can start there.

Sponsor our Newsletter | Privacy Policy | Terms of Service