Welcome Guest, Not a member yet? Register   Sign In
Programatically move existing uploaded files
#1

I am developing a document management system in CI4 that enables me to store scanned incoming paper documents, images etc.

The Documents table includes a Category field so that each uploaded file has a relevant Category - Letter, Invoice etc - that is selected in the Documents view form.  The upload folder is set to 'writable/uploads/[category name]' in the Controller, like this:

Code:
$img->move(WRITEPATH . 'uploads/' . $catName);

The above works fine and files are stored where I want them, but if I subsequently want to change the Category field for a particular record I need to be able to physically move the uploaded file to the new Category sub-folder.  Is that possible - I'm having no luck with similar img->move() code?

Incidentally, if I use img->store() during the initial upload rather than img->move(), the file is uploaded to a user folder under the 'public' folder instead of writable/uploads - anyone know why WRITEPATH is interpreted differently under those circumstances?

Thanks
Reply
#2

move_uploaded_file

PHP Code:
move_uploaded_file($from$to); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB