Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
file upload again
26/05/2009
22:24
Avatar
xuding
xuding
Member
Members
Forum Posts: 36
Member Since:
15/11/2008
sp_UserOfflineSmall Offline

Hi Tony:

I know that many ppl have asked why you are not adding a file upload field into modal box. and you have answered that we can integrate file uploader into jqgrid.

but for me, I still dun understand, why can not you just add <input type=file> into modal box. and it posts a file to the backend.

Regards

Xu Ding

27/05/2009
02:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

If you carefully read the changes in 3.5 maybe you will find edittype:'file'  😉

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

27/05/2009
02:59
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello again,

Sorry for this. I really missed this in the docs. Also we have a couple of new editteipes:

Thease types are

button, image and file.

Sorry again

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

27/05/2009
04:38
Avatar
xuding
xuding
Member
Members
Forum Posts: 36
Member Since:
15/11/2008
sp_UserOfflineSmall Offline

well,well, what to say ?

awsome !

27/05/2009
19:53
Avatar
xuding
xuding
Member
Members
Forum Posts: 36
Member Since:
15/11/2008
sp_UserOfflineSmall Offline

Hi,Tony

I have tested the edittype: file.

and I found out that it did give me a <input type=file> ,but my doubt is that in it did not post the file from modal box. 

Do I need to set something else except edittype:file, in order to let the modal box post file to the backend ?

Regards

The-Di-Lab

ps: The-Di-Lab = Xu Ding

28/05/2009
04:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Yes, the file is not uploaded. As you known uploading a file requiere diffrent approach. I put this in order to be easy use some other plugin like this one:

http://www.phpletter.com/Demo/.....load-Demo/

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

28/05/2009
08:44
Avatar
xuding
xuding
Member
Members
Forum Posts: 36
Member Since:
15/11/2008
sp_UserOfflineSmall Offline

Okay, I see.

Then I think I have already put up the above plugin with jqgrid 3.4 in my demo

page.

http://www.the-di-lab.com

Thanks anyways.

Regards

The-Di-Lab

28/05/2009
08:53
Avatar
xuding
xuding
Member
Members
Forum Posts: 36
Member Since:
15/11/2008
sp_UserOfflineSmall Offline

But still I think it won't be very tough to make the modal box to post file out. isn't it ?

Just need to set the <form> in modal box with correct parameters such as

enctype="multipart/form-data", method ="post"

and when add/edit is clicked, it posts the file.

correct me if  i am wrong.

I think it will be a great enhancement if jqgrid is able to handle file upload.

Regards

The-Di-Lab

31/05/2009
11:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

It is not so easy. Instead that we use form jqGrid post data to the server via ajax. As you known file upload via ajax is not possible, we need to make some trick (use hidden iframe) to do this, but I think it is better to use another plugin.

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

28/05/2010
07:26
Avatar
Ricardo Montalban
Member
Members
Forum Posts: 9
Member Since:
28/05/2010
sp_UserOfflineSmall Offline

Hello Tony,

How would you implement using another plugin within jqgrid? I have an edit field that is part of a larger form and I would like to enable image uploading so how would I even begin to integrate something like that phpletter plugin you linked to?

-Best

RM

30/05/2010
12:42
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

here is a little code sniplet which works ok in my app using the phpletter plugin

onInitializeForm : function(formid)

{

//These are needed for fileupload plugin
$(formid).attr("method","POST");
$(formid).attr("action","");
$(formid).attr("enctype","multipart/form-data");
// Create a button bellow the file field
$("<br/><button id='buttonUpload'>Upload</button>").insertAfter("#fileToUpload",formid);
// bind a event
$("#buttonUpload",formid).click(function(){
    $.ajaxFileUpload({
        url:'doajaxfileupload.php',
        secureuri:false,
        fileElementId:'fileToUpload',
        dataType: 'json',
        success: function (data, status) {
            if(typeof(data.error) != 'undefined')
            {
                if(data.error != '')
                {
                    alert(data.error);
                }else{
                    $("#fileToUpload").val("");
                    alert(data.msg);
                }
            }
        },
        error: function (data, status, e)
        {
            alert(e);
        }
    });
    return false;
});

}

Where "fileToUpload" is a colmodel field defined as edittype – file

Hope this helps

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

01/06/2010
10:41
Avatar
Ricardo Montalban
Member
Members
Forum Posts: 9
Member Since:
28/05/2010
sp_UserOfflineSmall Offline

Hi Tony, thank you for the response. It seems that snippet you included might work when the only thing being uploaded is a file and no other fields?

I have a form with a number of text fields as well as a photo, when you click the "edit" button a modal pops up with the various editable fields and a file field (because the photo has edittype: 'file') but the form is not enctype="multipart/form-data" so no image can be uploaded.

What I'm trying to figure out is this:

1. I have a grid that has an image, a name and a caption

2. There is an edit button that, when clicked opens a modal window with a form to edit those three things

3. This form has a file input field and two text fields

4. You select the image, enter the text, hit submit and everything gets uploaded/updated/added.

Is this just not possible with jqgrid? It seems you can upload a file (using a third-party ajax file upload plugin) or you can handle text fields but you cannot do both in one form with jqgrid. Is this correct?

02/06/2010
20:38
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

HEllo,

I think that this is possible using formatters

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

29/11/2010
22:16
Avatar
riza_nurhadi
Indonesia
New Member
Members
Forum Posts: 1
Member Since:
29/11/2010
sp_UserOfflineSmall Offline

Hello ,

my problem is the same.

i need to upload the file. but at the same time i need file manager.

and it seems like uploading the file using jqGrid is not the solution.

i found 2 solution to upload the file and at the same time using file manager to manage the file.

that is using free plugin

using jqGrid only to save the path to the file.

  1. Using KcFinder http://kcfinder.sunhater.com/
  2. Or Using KFM File Manager http://kfm.verens.com/

I'm choosing KcFinder because that plugin doesn't need to create table in dbase. and its preety simple to integrate.

KFM is also a good plugin but i'm not using it because i still don't know how to handle the security problem in CodeIgniter.

so KcFinder it is. its simple.

this my configuration in colModel

,{

     name:"file"

     ,index:"file"

    ,editable:true

    ,editoptions:{

         ,readonly:"true"

         ,dataInit:function(element){

                // KCFINDER

                window.KCFinder = {
                                    callBack: function(url) {
                                        window.KCFinder = null;
                                        $("#file").val(url);
                                    }
                                };
                                window.open("yourURL/kcfinder/browse.php?type=files&dir=files/public", "kcfinder_textbox",
                                    "status=0, toolbar=0, location=0, menubar=0, directories=0, " +
                                    "resizable=1, scrollbars=0, width=800, height=600"
                                );

                  // KFM

                 // window.SetUrl=function(val){
                            // val=val.replace(/[a-z]*:\/\/[^\/]*/,\'\');
                                // $("#file").val(val);
                            // };
                            // var kfm_url="yourURL/kfm/";
                            // window.open(kfm_url,"kfm","modal,width=600,height=400");

         }

    }

}

With this you can get the "Path to Your File" value and save it into textbox.

KcFinder can use IFRAME to open FileManager. if you can integrate it. please tell me 🙂

21/06/2011
00:21
Avatar
internetbug256
Buenos Aires, Argentina
Member
Members
Forum Posts: 6
Member Since:
30/01/2009
sp_UserOfflineSmall Offline

Hi Riza

Are you sure that the above code actually works? I tried it using KCfinder and the file uploader appears only when creating the inline form. It appears right on top of the inline form, without asking permission, and it never loads again.

I think I am missing something here, like triggering the uploader too in some other event, but since I am newbie to Jqgrid, I can't figure it out...

Any help out there? Thanks

Gabriel

Gabriel Schillaci

26/09/2011
18:27
Avatar
kobruleht
Member
Members
Forum Posts: 144
Member Since:
05/05/2011
sp_UserOfflineSmall Offline

ajaxFileupload() uses undocumented jquery handleError() method. HandleError was removed in jquery 1.5 .

So this code does not work anymore. Also this does not post other form fields.

Where to find sample which posts file and other form fields also in submit button is clicked in add or edit form?

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
59 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information