Welcome Guest, Not a member yet? Register   Sign In
Get base name upload
#3

(06-29-2018, 10:24 AM)Nome Wrote: Sorry... Perhaps this is too simple a question: How to get the full name of the file at uploading?

Example:

picture.jpg

$file->getBasename() 

since I noticed that the temporary file name is returned...

Thanks!

Using the example code below, create a variable using the line of code you created for the upload path, then concatenate with the file name. The example variable below is $imagepath. This variable will represent the full path to your file. 



Code:
public function do_upload()
       {
       $config['upload_path'] = 'public/uploads/';
       $config['allowed_types'] = 'jpg|png';
       $config['max_size'] = 100;
       $config['max_width'] = 1024;
       $config['max_height'] = 768;

       $this->load->library('upload', $config);


// The $imagepath variable holds the full path to the file
       $imagepath = $config['upload_path'].$this->upload->data('file_name');
Reply


Messages In This Thread
Get base name upload - by Nome - 06-29-2018, 10:24 AM
RE: Get base name upload - by php_rocs - 07-01-2018, 05:59 PM
RE: Get base name upload - by matchplay - 07-01-2018, 08:15 PM
RE: Get base name upload - by kilishan - 07-02-2018, 09:26 AM
RE: Get base name upload - by Nome - 07-04-2018, 02:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB