Codeigniter update image upload?

When you want to overwrite an old avatar file you should load the path to your old image from the database unlink (delete) the old file, then write the new file and lastly write the path to the new file to the database.

When you want to overwrite an old avatar file you should load the path to your old image from the database, unlink (delete) the old file, then write the new file and lastly write the path to the new file to the database.

Dave: look in the model, where : if (!empty($profile_field)) { $profile_avatar = $this->input->post('profile_avatar'); } else { $profile_avatar = $profile_field; } I think there is a '! ' that is wrong. It should be if (empty($profile_field)) { $profile_avatar = $this->input->post('profile_avatar'); } else { $profile_avatar = $profile_field; } may be this is the mistake.

Now on to uploading the file. The URL we are uploading to is /upload/upload_file/, so create a new method in the upload controller, and place the following code in it. This code loads in the CodeIgniter upload library with a custom config.

For a full reference of it, check out the CodeIgniter docs. We do a simple check to determine if the title is empty or not. If it isn’t, we load in the CodeIgniter upload library.

This library handles a lot of our file validation for us. Next, we attempt to upload the file. If successful, we save the title and the filename (passed in via the returned data array).

Remember to delete the temp file off the server, and echo out the JSON so we know what happened.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions