Hi,everybody,

i created fileuploader,fileupload display one image.select another
image first one is disapper.i want to same time user select more than 10 images display all the images one by one.
anybody,

plz help me.

This is my code.

public function executeUpload(sfWebRequest $request)
  {



    $fileName = $request->getParameter('qqfile');
    $newpath = $this->_uploadProgress($fileName,'uploads');

    $obj = new stdClass();
    //$obj->array('fileName')=$newpath;
    $obj->fileName = $newpath;
    $obj->success = true;
    print json_encode($obj);
    return sfView::NONE;

  }
}



private function _uploadProgress($filename, $uploadpath)
  {
      if(isset($_SERVER['CONTENT_LENGTH']))
        $file_size = $_SERVER['CONTENT_LENGTH'];
    else
        throw new Exception('Getting content length is not supported.');
    $input = fopen("php://input", "r");
    $temp = tmpfile();
    $realSize = stream_copy_to_stream($input, $temp);
    fclose($input);

    $target = fopen($uploadpath."/".$filename, "w");        
    fseek($temp, 0, SEEK_SET);
    $file_size = stream_copy_to_stream($temp, $target);
    fclose($target);
    if($file_size > 0)
        return $uploadpath."/".$filename;
    else
        return false;
  }



$(document).ready(function(){
var uploader = new qq.FileUploader({
element: document.getElementById('upload_button'),
           // element: $('#upload_button'),
            action: upload_url,
            params: {
                meetnewpeopleid: 2
            },
            allowedExtensions: ['jpg', 'val', 'webm','png'],
            onComplete: function(id, fileName,responseJSON){

                alert(responseJSON.fileName);
                $('#upload_image').attr('src',"http://localhost/public_html/web/"+responseJSON.fileName);
                return true;

            }
});
});

Thanks to everybody.

Instead of overwriting the image with id upload_image, add another image to your page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.