Welcome Guest, Not a member yet? Register   Sign In
Upload Class orig_name
#1

[eluser]CoffeeBeanDesign[/eluser]
Hi there,

Glad to see file_name added to the latest version of the Upload Class however it seems to mess up the orig_name variable. If you set a file_name the orig_name is changed too.

Line 245 :
Code:
$this->orig_name = $this->file_name;

I think it should come earlier, before the name has been changed :

Somewhere like line 190 :

Code:
// Set the uploaded data as class variables
$this->file_temp = $_FILES[$field]['tmp_name'];    
$this->orig_name =$_FILES[$field]['name'];    
$this->file_name = $this->_prep_filename($_FILES[$field]['name']);

I'm not 100% sure of the logic of why the orig_name is set afterwards, there may be a perfectly good reason, perhaps I just can't see it yet...
#2

[eluser]hotmeteor[/eluser]
Ya, this is a bug. I've reproduced it while doing a multi-file upload loop.

Basically, all of the filedata is reset in the loop for the new file, EXCEPT for orig_name. But adjusting the code as stated above it fixes it. Not sure why though.




Theme © iAndrew 2016 - Forum software by © MyBB