View Full Version : [updated] EXTJS ajax five file upload example
jay@moduscreate.com
10 Jul 2007, 11:02 AM
You'll not see a single advertisement in my examples.
OK, so the page itself isn't very verbose,
If you download the zip, you'll need GD + JPEG/GIF/PNG/TIFF libs + PHP, modify index.php to change ext location.
This example checks all five entries and will clear successful uploads only
Example link: http://www.tdg-i.com/extexamples/fileupload
This does NOT work for IE6, for some reason form.submit opens a popup. trying to figure out why
galdaka
10 Jul 2007, 11:31 AM
Hi,
Example link: http://www.tdg-i.com/extexamples/fileupload
Fails in IE6. Works fine in FF.The dialog appears without import button
jay@moduscreate.com
10 Jul 2007, 11:34 AM
WTF. i'll look into it. heh :)
cluettr
10 Jul 2007, 11:50 AM
This worked for me perfectly in both IE7 and FF2. Awesome stuff... I so appreciate the help here and the time you took to compile and post this.
For anyone who is uploading this to their server keep in mind that you may have to change your permissions on the upload directory and/or change the specified path. That is the only thing that may be required to get this to work "out of the box".
jay@moduscreate.com
10 Jul 2007, 12:07 PM
I've updated the code for IE6, but it seems that for some reason on my work desktop, form.submit is creating a popup. in FF2 it works perfectly.
i'll file a bug report.
jay@moduscreate.com
10 Jul 2007, 12:20 PM
Folks, please no uploading pics of your penises. (:|
cluettr
10 Jul 2007, 7:35 PM
Oddly I'm getting an error with this when integrating it into my own code:
The function is Ext.util.Format and it references some XML tags.
XML tag name mismatch (expected br)
</p><p>\n
6477 Ext.util.Format = function(){
6478 var trimRe = /^\s+|\s+$/g;
6479 return {
6480
6481 ellipsis : function(value, len){
6482 if(value && value.length > len){
6483 return value.substr(0, len-3)+"...";
6484 }
6485 return value;
6486 },
jay@moduscreate.com
11 Jul 2007, 1:54 AM
is your server side code already setup to accept file uploads?
cluettr
11 Jul 2007, 5:34 AM
yes. It works when not integrated into my own code so I don't beleive it is your code specifically... I saw another post with the same message on what seems to be similar or the same code. Let me play with it to see if I can figure out which line of code is causing the issue.
jay@moduscreate.com
11 Jul 2007, 6:05 AM
try blanket return of "{'success' : true, msg : { files : [ {'file' : 1 , 'fileStatus' : '0', 'fileName' : 'moby_mini_red.jpg' } ] } }"
i've filed a bug for the problems i'm experiencing with file uploads. :(
http://extjs.com/forum/showthread.php?t=9041
willydee
13 Jul 2007, 3:10 AM
Be advised that the included PHP script(s) will fail if PHP config variable short_open_tag is Off. Moreover, when PHP error reporting level is set to E_ALL (recommended for debugging), E_NOTICE warnings are generated because of undefined variables. You might need to add a .htaccess file to make it work unmodified:
php_value short_open_tag On
php_value error_reporting 6135
jay@moduscreate.com
13 Jul 2007, 5:59 AM
the Ext.Form.form.submit() ie popup Bug will be fixed in RC2 it seems
http://www.tdg-i.com/extexamples/bug_screenshots/ext_ie_popup_bug_fixed.jpg
http://extjs.com/forum/showthread.php?goto=newpost&t=9041
This does NOT work for IE6, for some reason form.submit opens a popup. trying to figure out why
Guys, this code is working in IE6 (and IE7 and FF of courser) for me. the only thing I've changed is that I've included the yui adapter (1.0.1) in index.php:
<script type="text/javascript" src="content/extjs/yui-utilities.js" ></script>
<script type="text/javascript" src="content/extjs/ext-yui-adapter.js" ></script>
<script type="text/javascript" src="content/extjs/ext-all.js" ></script>
So is it possible that this thing doesn't like the 1.1 version with IE6?
jay@moduscreate.com
2 Aug 2007, 4:50 AM
it is.
I have setup an upload form using SWF Uploader and it works in all browsers. make sure you have the latest flash player:
click insert images: http://lhp.tdg-i.com/mastercontrol.php
ineed to do documentation for this.
fercho07
9 Aug 2007, 11:34 AM
it is.
I have setup an upload form using SWF Uploader and it works in all browsers. make sure you have the latest flash player:
click insert images: http://lhp.tdg-i.com/mastercontrol.php
ineed to do documentation for this.
Can you put the source code to download ?
Thanks.
galdaka
10 Aug 2007, 3:22 AM
Sorry for my English,
Why don
galdaka
10 Aug 2007, 3:27 AM
Sorry for my English,
Why don
noso
21 Aug 2007, 11:50 PM
[QUOTE=galdaka;53423]Sorry for my English,
Why don
jay@moduscreate.com
22 Aug 2007, 3:11 AM
[QUOTE=galdaka;53423]Sorry for my English,
Why don
obsidian
30 Sep 2007, 11:38 AM
Has there been any progress on figuring out the XML tag name mismatch? I'm running into that same error with simply attaching a BasicForm object to a static HTML form I have and then trying to submit it. Basically, I simply want to keep the form I have already generated and submit it via an AJAX call. The reason I'm wanting to use the BasicForm is that it is a file upload form. I am using a full Ext.form.Form creation and implementation elsewhere, so I have a basic understanding of the system.
Any ideas why Ext.util.Format() would be throwing this error?
jay@moduscreate.com
30 Sep 2007, 12:41 PM
Has there been any progress on figuring out the XML tag name mismatch? I'm running into that same error with simply attaching a BasicForm object to a static HTML form I have and then trying to submit it. Basically, I simply want to keep the form I have already generated and submit it via an AJAX call. The reason I'm wanting to use the BasicForm is that it is a file upload form. I am using a full Ext.form.Form creation and implementation elsewhere, so I have a basic understanding of the system.
Any ideas why Ext.util.Format() would be throwing this error?
can you post code and exactly what error you're experiencing?
obsidian
30 Sep 2007, 4:41 PM
can you post code and exactly what error you're experiencing?
Sure thing. Sorry I didn't do it last post, but I was piggybacking off the mention of this error earlier in the thread. Here's the background and relevant code: I have a site that has been working for some time, and I simply want to attach BasicForm to some of my forms (with file uploads) to be able to submit them via AJAX and receive a JSON response with error message or whatever. Since I know the form works, I'm not going to post the code for it at this time, but if needed, I'll post a sample one. Here is the Javascript code I'm trying to use to submit the form:
var postForm = new Ext.form.BasicForm('add-post', {
url: 'ajaxapi/process_new_post_form.php',
method: 'post',
fileUpload: true
});
postForm.on('actioncomplete', function(fs, a) {
alert(a.resopnse.responseText);
});
Ext.get('post-submit').on('click', function() {
Ext.Msg.alert('submit', 'submitting');
postForm.submit();
});
As you can see, all I'm trying to do at this point is submit and alert the responseText from the AJAX call. I am getting the following error instead, and the alert() is never being triggered:
XML tag name mismatch (expected br)
.../ext-1.0.1/ext-all-debug.js
Line 6127
As you can see, I am indeed using the -debug JS file. Please let me know if there is any additional info I can give to help debug this issue.
Thanks!
jay@moduscreate.com
30 Sep 2007, 5:25 PM
what response are you sending back to the server?
I would highly suggest trying: http://extjs.com/forum/showthread.php?t=11111
i've abandoned my work due to the fact that it's impossible to reset the upload input box and/or i didn't feel like re-creating a new one each time.
obsidian
30 Sep 2007, 5:33 PM
Thanks again for the response. At this point, I'm returning this hard-coded message:
{success:true, msg: 'Hello'}
However, it is apparently not even getting that far since the alert never is reached at all. I am also sending it as a text/html document due to another thread I read. Sorry you're abandoning your work. I thought what I'm doing should be a very simple thing, but maybe not? :((
wolverline
2 Oct 2008, 4:03 AM
It doesn't work
kaigan
2 Oct 2008, 5:23 AM
It doesn't work
See the post by the author 2 posts up in this thread.
http://extjs.com/forum/showthread.php?p=68262#post68262
Also, this thread is almost exactly one year old, happy birthday thread ;)
Animal
24 Nov 2008, 5:02 AM
The Content-Type must be set as described in the API docs.
jay@moduscreate.com
24 Nov 2008, 5:58 AM
i believe this was originallly written in 1.x :-P
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.