javascript - Why do I get only 000000 as the add on number in a PHP Ajax file transfer with add on number? -


i got stackoverflow 000000 add on numbers:

1) want format id2 "000000" 6 digits, example if id2 302 should "000302"

2) want combine formatted data (000302) in .$_files['file']['name'] in upload.php file , save file new file name.

the $new_id have "000000", whatever do.

i still lost how it, first good!

the file transfer code not me. code internet.

i happy help!

this in head section:

<script type="text/javascript" src="js/multiupload.js"></script>  <script type="text/javascript">      var config =     {         support : "image/jpg,image/png,image/bmp,image/jpeg,image/gif",     // valid file formats         form: "demofiler",                  // form id         dragarea: "draganddropfiles",       // upload area id         uploadurl: "upload.php"             // server side upload url     }      $(document).ready(function(){         initmultiuploader(config);     });  </script> 

this in body section:

            <div id="draganddropfiles" class="uploadarea">             <br>             <span style="padding-left: 20px">to upload more pictures item click browse</span>             <br>             <span style="padding-left: 20px">the order of upload decide order show pictures</span>              </div>              <form name="demofiler" id="demofiler" enctype="multipart/form-data" style="">                 <input id="id2" type="hidden" name="id2">                 <input type="file" name="multiupload" id="multiupload" multiple />                 <input type="submit" name="submithandler" id="submithandler" value="upload" class="buttonupload" />              </form>              <div class="progressbar">                 <div class="status"></div>             </div> 

this file upload.php

            <?php             if($_server['request_method'] == "post"){                 $new_id = sprintf( "%06d", $_post['id2']);                 if(move_uploaded_file($_files['file']['tmp_name'], "sobimages/" . $new_id . $_files['file']['name'])){                     echo($_post['index']);                 }                 exit;             }?> 

you sending form field in form hidden:

<input id="id2" type="hidden" name="id2"> 

but has no value , user not see , fill in value, empty / 0.

you should not use approach user manipulate number. if have number available, should keep on server, example in session variable, , use instead.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -