use different upload name

  • Thread starter Alessandro (LotaBi)
  • Start date
A

Alessandro (LotaBi)

Guest
I use to change the name of upload files
to prevent duplicate names and link it with
other functions, for example in a web site

I'd like to rename the file as a primary key

ex. my_image.jpg --> ex. 00045.jpg

or add a primary key to original name

ex. my_image.jpg --> ex. 00045_my_image.jpg

Is this possible in DadaBik?

thank in advance

Alessandro
 
D

Debbie S

Guest
Alessandro

DaDaBIK already automatically gives file names an extension to prevent duplicate names when uploading.

image.gif
image_2.gif
image_3.gif
etc.

I suppose it may be possible to edit the code to accomplish what you are looking for. The code that adds the extension to the filename as descibed above starts on (or about) line 2951 (look for this text if you do not have line numbers --> function get_valid_name_uploaded_file ($file_name, $check_temp_files) <--).

Debbie
(Latest version of DaDaBIK when this message was posted: 3.1 Beta)
 
A

Alessandro (LotaBi)

Guest
ok, the rewrite option for the name inside in DADABIK is a good idea; in very improbable situation it does not work in perfect way:

example upload:

phamm.jpg --dadabik--> phamm.jpg
phamm.jpg --dadabik--> phamm_2.jpg

phamm_2.jpg --dadabik--> phamm_2_2.jpg
(and not phamm_3.jpg)

this is not important :p
---

my goal is associate a primary key to
name of file, this is possible modify
the function get_valid_name_uploaded_file
or write_temp_uploaded_files as you suggest, but difficoult without the variable (primary key) in the functions parms

 
Top