Note that there are some explanatory texts on larger screens.

plurals
  1. PORename file name using uploadify
    primarykey
    data
    text
    <p>i am uploading a image using uploadify,the problem is,in the model i am changing the file name which is pass by uploadify funciton.now i want that file name which is renamed in model in onUploadComplete property of uploadify.Im alerting that file name but it display the same file name which actually uploading. here is my code:-</p> <pre><code> 'buttonText' : 'Select', 'fileTypeDesc' : 'Image Files', 'fileTypeExts' : '*.gif; *.jpg; *.png', 'swf' :'&lt;?php echo base_url()?&gt;resources/flash/uploadify.swf', 'uploader' :'&lt;?php echo base_url().'user/upload_temp';?&gt;', 'width' : 40, 'multi' :false, 'onUploadComplete':function(file) { alert(file.name); $('.select_div').hide(); $('.original').hide(); $('#image1').attr('style','background-image:url("./resources/images/users/temp/'+file.name+'");background-size: 76px 76px;'); $('.default').hide(); $('#image2').attr('style','background-image:url("./resources/images/users/temp/'+file.name+'");background-size: 73px 66px;position:absolute; height:66px; width:73px; top:256px; left:220px;'); $('#hidden_img_value1').attr('value',file.name) } }); </code></pre> <p>and in model im doing like this :- $targetFolder = FCPATH.'/resources/images/users/temp/'; // Relative to the root if (!empty($image)) { $time=strtotime("now"); $image['Filedata']['name']=$time.'.jpg'; $tempFile = $image['Filedata']['tmp_name']; $targetPath = $targetFolder.$image['Filedata']['name'];</p> <pre><code> // Validate the file type $fileTypes = array('jpg','jpeg','gif','png'); // File extensions $fileParts = pathinfo($image['Filedata']['name']); if (in_array($fileParts['extension'],$fileTypes)) { move_uploaded_file($tempFile,$targetPath); echo '1'; } else { echo 'Invalid file type.'; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload