View Full Version : Upload Image

11 Jan 2012, 6:59 AM
image upload

i am new to Extjs i am trying to upload an image file to the server . can you give me idea on how to proceed on it? I know I need a script to handle the server side, but I'm confused as to how I would address that issue.

11 Jan 2012, 9:49 AM
server side is an open question. But for Ext JS 4 we have the File field that when you submit a form, it will upload the file

11 Jan 2012, 11:42 AM
I guess to be more specific, if I wrote a script in php to handle the server side uploading for the image, how would the server know when to execute the script or how does the script get tied into Extjs for uploading images/files. This is the most confusing part for me to understand.

11 Jan 2012, 11:55 AM
When you submit() on the form, it will send off the request to your PHP script to be handled.

26 Jun 2012, 6:30 AM
there is no problem with standalone form. form.submit() and all solved. BUT!
what if form does not get submitted at all?

Ext.Application pattern recommends following:
r = App.Model.SomeModel; //load or created doesn't matter
model has also field: filename which should be the filename from the filefield.

if form has some filefield it won't be uploaded on model.sync(). sure, why would it be. But then if form.submit() is called then whole record will be pushed.

So then have to have nested form with single element for doing something like this:

but then in this case model (from above) will not get the filename value of the uploaded form.

in the end gets quite nasty with whole model.sync() pattern once single filefield gets involved.