Welcome Guest, Not a member yet? Register   Sign In
Jquery + file upload problems
#6

[eluser]byde[/eluser]
I had the same problem, a friend told me that you can not upload files usen ajax, I doubt it but i didnt try that way.

So what i did was to submit the form to a popup windows, let me share my code.

Code:
[removed]
var win= null;
function NewWindow(mypage,myname,w,h){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars=yes,';
      settings +='resizable=yes';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
window.addEvent('domready', function() {
    $("uploadForm").addEvent('submit', function (e) {
        e.preventDefault();
        NewWindow('', 'subir_foto', 300, 400);
        this.target = 'subir_foto';
        this.submit();
    });
});
[removed]

          <?php echo form_open_multipart('banners/do_upload', $attr);?>
            <p><label>Imagen a subir &lt;input type="file" name="userfile" size="20" /&gt;&lt;/label></p> ...

banners/do_upload recibes the form data with the image, in the popup window you can use javascrpt to call functions in the openner one or close it

i did this
Code:
[removed][removed]
[removed]
window.addEvent('domready', function() {
//    window.resizeTo($("im").get('width'),$("im").get('height'));
    window.opener.ActualizarImg();
});
[removed]
<img src="&lt;?php echo base_url() ?&gt;&lt;?php echo $img; ?&gt;" width="200px" id="im" />
this last one (""window.opener.ActualizarImg();"") updates a list of images from ajax but in the openner window


As you can see, i did it with mootools, but it is very similar in jquery, actually in this code only changes the selector, i didnt find a jquery example

You can send me a PM so i can help you


Messages In This Thread
Jquery + file upload problems - by El Forum - 03-22-2011, 12:37 PM
Jquery + file upload problems - by El Forum - 03-22-2011, 01:41 PM
Jquery + file upload problems - by El Forum - 03-22-2011, 02:03 PM
Jquery + file upload problems - by El Forum - 03-23-2011, 02:45 AM
Jquery + file upload problems - by El Forum - 03-27-2011, 05:21 PM
Jquery + file upload problems - by El Forum - 03-27-2011, 05:56 PM
Jquery + file upload problems - by El Forum - 03-27-2011, 10:35 PM
Jquery + file upload problems - by El Forum - 03-28-2011, 01:03 PM
Jquery + file upload problems - by El Forum - 03-28-2011, 02:08 PM
Jquery + file upload problems - by El Forum - 03-29-2011, 06:24 AM
Jquery + file upload problems - by El Forum - 03-29-2011, 08:30 AM
Jquery + file upload problems - by El Forum - 03-29-2011, 08:31 AM
Jquery + file upload problems - by El Forum - 03-29-2011, 12:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB