php - How to change uploaded file name in Magento? -


i using system.xml configuration upload file via backend. works perfectly.

but need change uploaded image's name current store id. how can i? uploaded original name.

my system.xml

<?xml version="1.0"?> <config>   <tabs>     <restaurant translate="label" module="restaurant">         <label>upload logo</label>         <sort_order>999999</sort_order>     </restaurant>   </tabs>   <sections>     <restaurant_options translate="label">       <label>upload logo</label>       <tab>general</tab>       <frontend_type>text</frontend_type>       <sort_order>1000</sort_order>       <show_in_default>1</show_in_default>       <show_in_website>1</show_in_website>       <show_in_store>1</show_in_store>        <groups>             <sample translate="label">               <label>upload store's logo</label>               <frontend_type>text</frontend_type>               <sort_order>100</sort_order>               <show_in_default>1</show_in_default>               <show_in_website>1</show_in_website>               <show_in_store>1</show_in_store>               <fields>                     <enabled translate="label comment">                         <label>logo</label>                         <comment>file types: jpeg, gif, png.</comment>                         <frontend_type>image</frontend_type>                         <backend_model>adminhtml/system_config_backend_image</backend_model>                         <upload_dir config="system/filesystem/media" scope_info="1">theme</upload_dir>                         <base_url type="media" scope_info="1">theme</base_url>                         <sort_order>1</sort_order>                         <show_in_default>1</show_in_default>                         <show_in_website>1</show_in_website>                         <show_in_store>1</show_in_store>                     </enabled>             </fields>             </sample>       </groups>     </restaurant_options>   </sections> </config> 

please if know solution.

as far know. first insert record database , inserted id using

$uniqid = mysql_insert_id();

then

move_uploaded_file($_files['userfile']['tmp_name'], $path_to_upload . $uniqid);

beware: don't forget file extension.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -