logo
down
shadow

Not able to store image name in database


Not able to store image name in database

By : Emini
Date : November 20 2020, 01:01 AM
I wish this helpful for you First off the form validation does not work with $_FILES only $_POST. You should use the CI upload class which will also allow you to better validate image types. Currently you are doing the image type validation twice - once in the controller and once in the model. This is probably not required.
Change your controller function to something like this:
code :
function add(){
    if($this->session->userdata('user_id'))
    { 
    $config['upload_path'] = FCPATH."resources/images/logo/";
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size']    = '100';//eg
    $config['max_width']  = '1024';//eg
    $config['max_height']  = '768';//eg
    $config['file_name']  = $your_random_file_name;
    //more config - 

    $this->upload->initialize($config);

    if (!$this->upload->do_upload('pp_image'))
    {
        $this->session->set_flashdata('error','Invalid Image');
        redirect('setting/add');
    } else {

        //just pass your new filename & path to your model to go in the db
        $this->your_model->add($your_random_file_name);
        return true;
    }
  }
}


Share : facebook icon twitter icon
CodeIgniter - Uploading an Image through a form, store the location of the image in database

CodeIgniter - Uploading an Image through a form, store the location of the image in database


By : rohitab
Date : March 29 2020, 07:55 AM
help you fix your problem CodeIgniter's file uploading class will do this for you. The entry in their user guide explains as well as I could, so I'm going to point you there.
Essentially you'd just need to modify the controller that they have there to include a bit where you put the file URL in the database, which you can accomplish easily by using $this->upload->data() and extracting [full_path] from the resulting array, and then sending it to a model which handles the database input.
When to store images in a database(mySQL) and when not? (Linking image to item in database)

When to store images in a database(mySQL) and when not? (Linking image to item in database)


By : user3858762
Date : March 29 2020, 07:55 AM
I wish this helpful for you Advantages of storing images/blobs in the database
Storing the images is automatically part of your transactions No need to cleanup the file system and sync it with the database Access to the images is controlled through the same means as access to the rest of the data Only one single backup to care about A database is usually better suited to stored million (if not billions) of records. In the filesystem you have to find a clever distribution over several directories. A single directory will not be able to handle millions of files efficiently. For some workloads storing the images in the database could actually be faster.
how to browse an image and store that image in the database using LINQ to SQL in ASP.NET and how to retrieve that image?

how to browse an image and store that image in the database using LINQ to SQL in ASP.NET and how to retrieve that image?


By : niraj agrahari
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further There are many articles on doing exactly this. Here are some links:
http://www.c-sharpcorner.com/uploadfile/LivMic/using-linq-when-working-with-images-in-web-application/
Laravel - Store uploaded image path in database,retrieve and display the image

Laravel - Store uploaded image path in database,retrieve and display the image


By : nysingh
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Below is the steps I did regarding upload and retrieve user related images.
For the example, a user upload his profile picture which named myfile.png
How to store image in firebase storage and save the image url in realtime database

How to store image in firebase storage and save the image url in realtime database


By : Kimber Wind
Date : March 29 2020, 07:55 AM
I wish this help you The download URL is no longer available on the task snapshot that you use to monitor the upload task. Instead you need to call getDownloadURL() on the StorageReference once the upload has completed. See the sample in the documentation on monitoring upload progress. Applied to your code, this becomes:
code :
var storageref = firebase.storage().ref('gallery/' + litrato.name);
var uploadTask = storageref.put(litrato);
uploadTask.on('state_changed', function(snapshot){
}, function(error){
  console.error(error);
}, function() {
  uploadTask.snapshot.ref.getDownloadURL().then(function(downloadURL) {
    console.log('File available at', downloadURL);
  });
});
Related Posts Related Posts :
  • How to make a sitemap using zend framework 1
  • Laravel: array to Model with relationship tree
  • $_SERVER['DOCUMENT_ROOT'] vs $path = $_SERVER['DOCUMENT_ROOT']
  • What is the best way to store multiple checkbox values in the database and work with it later on
  • Why does foreach copy the array when we did not modify it in the loop?
  • Receive Jquery/Ajax Post Request in PHP
  • How to better use the if(!empty()){ //codes} statement
  • PHP error mysql_close() boolean given
  • Move an image file from one server to another using PHP
  • PHP: Encoding non ISO-8859-1 charactrers into utf8
  • Handling MySQL errors in PHP
  • Object orientated mysql num_rows query in one line
  • Remove not closed html elements from end of text
  • Generate random ENUM value [PHP, MySQL]
  • Deleting data from table using jQuery and SQL
  • How to make sure the constructor is executed when I'm trying to reach a static property?
  • Trying to understand arrow next to PHP function
  • Form using external php file to show "Sucess"
  • WooCommerce - new shipping method - how to query individual product weights
  • Common integer representation over variable casting?
  • PHP - Prevent client from tampering the ID of a form
  • unexpected T_PUBLIC error
  • Types of testcases in PHPUnit
  • keeping a LDAP user logged in with PHP session
  • Detect if browser supports WebP format? (server side)
  • real_escape_string not cleaning up entered text
  • E-commerce products filter
  • Why having more than one test method in a file using Laravel raises error?
  • PHP Escaped special characters to html
  • Basic prepared statement not INSERTING
  • PHP combobox not showing in HTML table
  • MySql PHP row request to variable
  • Join two tables with one table has multiple rows matching
  • Looping through users with Instagram API requests is REALLY slow
  • Unable to add 30 days to date within loop
  • Return from mysqli_query() into array
  • php rename() function returns "No such file or directory" error
  • form submit inside navigation menu
  • PHP: reasons to use GET and POST request at the same time?
  • Is break; required after die() php
  • little depth of session in php
  • Authentication Logon page not working using PHP and Oracle on Apache / Windows 2008
  • Magento reindexing error product flat data
  • Laravel 4: Running composer when deploying to Heroku
  • Long Polling or WebSockets
  • How to use mysqli_stmt_bind_param for integers, boolean, etc
  • Determining the content of a link
  • MYSQL and PHP update events?
  • PHP explode all square bracket
  • Transparent hexagon-masked collage using PHP GD
  • Plugins or text do NOT show up on custom wordpress template
  • inserting data into mysqli database
  • Two arguments to closure function laravel
  • UnClear image exported by ffmpeg from mp4 file
  • is the time of computer and localhost same?
  • change custom data- value after ajax post success
  • Can We Restrict PHP Variables to accept only certain type of values
  • csv file is inserting a blank row in the last of other rows into mysql table
  • How to convert special characters in xml using php?
  • Mcrypt are very confusing
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org