PHP-MySQL-database-integration

2,339 views
Skip to first unread message

JOEY MARTIN

unread,
Sep 19, 2013, 9:30:09 AM9/19/13
to jquery-f...@googlegroups.com
I read the docs at https://github.com/blueimp/jQuery-File-Upload/wiki/PHP-MySQL-database-integration
I understand to replace index.php with the code included. But, when I get down to the Client-side file upload initialization part,
I am not sure where exactly to put this in BASIC.html. I see where the old code is, but how much of it do I replace?

And for the 2 "additions" notes, are those required?
Thanks!

JOEY MARTIN

unread,
Sep 19, 2013, 9:39:51 AM9/19/13
to jquery-f...@googlegroups.com
Figured it out. I replaced that whole section in basic.html and it works now.

JOEY MARTIN

unread,
Sep 19, 2013, 10:41:02 AM9/19/13
to jquery-f...@googlegroups.com
Ok, well it was working. Then all of a sudden it just stopped working. I didn't do anything. It just stopped. No progress bar or anything. Ideas?


On Thursday, September 19, 2013 8:30:09 AM UTC-5, JOEY MARTIN wrote:

Walter Javier Calvo

unread,
Nov 8, 2013, 1:05:12 PM11/8/13
to jquery-f...@googlegroups.com
hi Joey:

You have to put this code:

$('#fileupload').fileupload({
    url: 'server/php/'
}).on('fileuploadsubmit', function (e, data) {
    data.formData = data.context.find(':input').serializeArray();
});

in js/main.js (old code commented)

$(function () {
'use strict';

// Initialize the jQuery File Upload widget:

$('#fileupload').fileupload({
url: 'server/php/'
}).on('fileuploadsubmit', function (e, data) {
data.formData = data.context.find(':input').serializeArray();
});
// old code below
/*$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: 'server/php/'
});
*/

and..

<label class="title"> <span>Title:</span><br> <input name="title[]" class="form-control"> </label> <label class="description"> <span>Description:</span><br> <input name="description[]" class="form-control"> </label>

in (the file you are using to upload, maybe index.html at the root of uploader dir

Example:

<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td>
<span class="preview"></span><br>
<label class="title">
<span>Title:</span><br>
<input name="title[]" class="form-control">
</label>
<label class="description">
<span>Description:</span><br>
<input name="description[]" class="form-control">
</label>
</td>

Дмитрий Власов

unread,
Nov 11, 2013, 1:06:28 AM11/11/13
to jquery-f...@googlegroups.com
Привет, а как сделать изменить данных имени и описания после загрузки изображения, например, добавить кнопку "изменить"?
Hi, how to make changes to the data 'title' and 'description' after the image is loaded, for example, add a button to "change"?

HTML:
<p class="title"><strong>Имя <br /><input name="title[]" value="{%=file.title||''%}"></strong></p>
<p class="description">Описание<br /> <input name="description[]" value="{%=file.description||''%}"></p>

PHP:
public function update($print_response = true) {
        $response = parent::update(false);
        foreach ($response as $name => $update) {
        if ($update) {
        $sql = 'update set  `title`=? ,`description`=? ' 
        .$this->options['db_table'].'` WHERE `name`=?';
        $query = $this->db->prepare($sql);
       $query->bind_param('s', $name);
       $query->execute();
        }
        } 
        return $this->generate_response($response, $print_response);
    }
JS:?

Michael Tran

unread,
Dec 4, 2014, 3:02:16 AM12/4/14
to jquery-f...@googlegroups.com
Thanks Walter, this really saved me.
Was stumped on this problem as well.

Wish the docs was clearer.

Eddie Hughes

unread,
Dec 20, 2014, 12:52:40 PM12/20/14
to jquery-f...@googlegroups.com
This is the first time I have ever used, or even posted in Google groups. I was also so confused with the 
jQuery-File-Upload › PHP integration! Then I found this thread and it is all working perfectly! Thanks so much!

Eddie

Omar Lefebre

unread,
Oct 28, 2015, 2:07:12 AM10/28/15
to jQuery-File-Upload

gracias por la ayuda

Ömer HELVACI

unread,
Sep 27, 2016, 1:29:13 PM9/27/16
to jQuery-File-Upload
hi, this code will be written in which files. Help me ( main.js, index.php, UploadHandler.php ??? )

8 Kasım 2013 Cuma 20:05:12 UTC+2 tarihinde Walter Javier Calvo yazdı:
Reply all
Reply to author
Forward
0 new messages