rename uploaded file - bug? |
[eluser]Ickes[/eluser]
Hello. Could very well be me but I was having a problem renaming a file when using the upload library. I have come up with a solution too (albeit not that pretty of one). Currently Upload.php library reads as... Code: // Set the uploaded data as class variables The issue comes in when you set $config['file_name'] before running $this->upload->do_upload(); I could not get my $config['file_name'] to be the name of the new file. It seems the upload library was overwriting Code: $this->file_name Code: $this->_prep_filename($_FILES[$field]['name']) Does that make sense? Here is the fix I came up with... Code: // Set the uploaded data as class variables Thoughts?
[eluser]BrianDHall[/eluser]
I haven't seen this problem when using the upload class, so perhaps you could post code that you find exhibits this bug in naming? My experience was that if I set $config variables then loaded them such as: Code: $config['file_name'] = 'newfile'; ...then it will work just fine, though I am unsure of exactly what happens if you try to rename to a file name that already exists. For this reason I preferred using encrypt_name=true and overwrite=false options.
[eluser]dunken[/eluser]
I have the same problem as Ickes. controller Code: $config['upload_path'] = 'files/'; Code: function add_document($header, $flow, $section, $config){ 1. First of all I must say that the mime-type-problem is pretty annoying, u must have the pictures at the end. 2. While i know that it reads the $config (it puts my files on the right place) it dosent seam to care about my $config[file_name] = time(); Is it only the two of us that has this problem?
[eluser]Unknown[/eluser]
this bug is fixed at last version http://dev.ellislab.com/svn/CodeIgniter/...Upload.php
[eluser]Ian Jones[/eluser]
I'm glad I found this thread, thought I was going bonkers. So this is fixed in versions later than the current? > 1.7.2
[eluser]onlyjf[/eluser]
The better way is http://codeigniter.com/bug_tracker/bug/10800/ |
Welcome Guest, Not a member yet? Register Sign In |