Rename uploads(multiple files with the ajax function)

kouwearie

Member
Is it possible(and how to do it lol) when using the fileupload element with ajax upload enabled to rename the files to e.g {mytable___internal_id}-??(1 to 99 if 99 files uploaded), so if the internal_id is 245, and 5 .jpg files would be uploaded, the result would be the files are renamed as:
"245-1.jpg"
"245-2.jpg"
"245-3.jpg"
"245-4.jpg"
"245-5.jpg"
 
Can't do that, as we won't always know the internal_id, like if it's a new row. The id doesn't get assigned till after the row has been created, which doesn't happen till after the actual form has been submitted.

-- hugh
 
I'm not even sure if the 'upload and increment file name' option works with AJAX uploads, that's something you might want to test, by uploading a file with the same name mulitple times through AJAX.

-- hugh
 
Its auto incrementing the current filename, and alters filenames when a file with the same filename exists.
2129wu8.jpg

20h3w3p.jpg


Heres a screenshot of the files actually being in the assigned folder:

mtazjr.jpg
 
A bit more info: If Obfuscate Filename is turned on it adds the amount of characters specified in the length filename field
 
Can't do that, as we won't always know the internal_id, like if it's a new row. The id doesn't get assigned till after the row has been created, which doesn't happen till after the actual form has been submitted.

-- hugh
Wouldnt it be possible the files are renamed on submitting the form?(Maybe then placeholder assignment for filename could be possible also then, or am i crossing the line now?)
 
It is possible and has been asked a few times in the past, I made a hack that does this in Fabrik 2.

Having said that we didn't have all the fancy Ajax stuff when I done it and I was only doing it for a single file uploads.

I think this should certainly go in as a feature request but I wouldn't expect anything for a while even if it becomes an agreed request.


If you post it here you'll have my vote, heh heh.


http://fabrik.uservoice.com
 
Hadnt checked MySql, but i noticed a new table formed: thistable___repeat_fileuploadelementname

=============================================

id, parent_id, fileuploadelementname, params

---------------------------------------------

id int(6) PK

parent_id int(6)

fileuploadelementname text

params text
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top