Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ajax Programming

problem with upload form ajax [sack]


I'm using "sack". More information at
http://www.twilightuniverse.com/2005/05/sack-of-ajax/

I've got a form like this:

<form action="external/registeer.php?go=check_image" method="post"
enctype="multipart/form-data" name="regi">
<p>
<input name="image" type="file" lang="nl" onChange="check_images();" >
</p>
<div id="check_image"></div>
</form>

The Ajax code i use is sack. The function I made is this one:

function check_images(){
var form = document.getElementById('regi');
ajax.setVar("image", form.image.value); // recomended method of setting
data to be parsed.
ajax.requestFile = "external/registeer.php?go=check_image";
ajax.method = "POST";
ajax.element = 'check_image';
ajax.onLoading = whenLoading;
ajax.onLoaded = whenLoaded;
ajax.runAJAX();

}

The problem is I don't get the info form '"image" in to
external/registeer.php?go=check_image"; I think it is a array problem.
The online info I get is. Image['name'] and no image['tmp_name']
Please help me...

You are going to have to post the image to an hidden iframe.

Eric

On 1/10/07, Wouter <vanree@gmail.com> wrote:

On Jan 10, 6:19 pm, "Eric Pascarello" <alienf@gmail.com> wrote:

> You are going to have to post the image to an hidden iframe.

> Eric

Yeah, basically XHR doesn't do uploading of files. That can only be
done using a normal HTML form, thus it either has to be done on the
page itself or in an iframe (hidden or otherwise). It's unfortunate,
but I suppose it helps with security a little more than giving
javascript access to the filesystem... although I hope they'd bring in
a way of directly uploading a file input via XHR. That won't have to
give javascript access to the filesystem, and will allow ajax
programmers to do much better stuff without the (what I think of as)
hacky hidden iframes...

Al

-----------------------------------------------Reply-----------------------------------------------

The image is a array. The value I get form print_r ($_POST); is the
name form the image and not alle the informtaion from the array. Lijk
tmp_name. So I can i post the array?

-----------------------------------------------Reply-----------------------------------------------
On Jan 11, 1:05 pm, "Wouter" <vanree@gmail.com> wrote:

> The image is a array. The value I get form print_r ($_POST); is the
> name form the image and not alle the informtaion from the array. Lijk
> tmp_name. So I can i post the array?

I think what's happening it that the form is technically working, but
the file itself isn't being uploaded. Thus you get your $_FILES array
filled with some text, but you don't get a temp name as there was no
file uploaded to php and thus no file was stored temporarily for you.

I could be wrong, but that's my guess..

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc