admin管理员组

文章数量:1023242

First , i am a french web developer ( sorry for my poor english )

i 'am looking for a bootstrap php image upload with thumbnail.

i would like to make an upload image file like :

[/][1]

the Krajee plugin ([][2]) seems to be the one i am looking for..

But i have some problems with the upload..

i get the error message:

item1.png: SyntaxError: Unexpected token e

my form:

   <input id="input-700" name="kartik-input-700" type="file" multiple=true class="file-loading">

js:

 $("#input-700").fileinput({
uploadUrl: "upload.php",
uploadAsync: true,
maxFileCount: 10});

upload.php:

echo "test";

if (empty($_FILES['input-700'])) {
echo json_encode(['error'=>'No files found for upload.']); 
return; 
}

// get the files posted
$images = $_FILES['input-700'];
var_dump($images);

More strange: when i delete echo(test); i get the error: No files found for upload

Thanks for your support

if you have another solution , i shall be glad to get it..

First , i am a french web developer ( sorry for my poor english )

i 'am looking for a bootstrap php image upload with thumbnail.

i would like to make an upload image file like :

[http://www.2ememain.be/inserer/][1]

the Krajee plugin ([http://plugins.krajee./file-input][2]) seems to be the one i am looking for..

But i have some problems with the upload..

i get the error message:

item1.png: SyntaxError: Unexpected token e

my form:

   <input id="input-700" name="kartik-input-700" type="file" multiple=true class="file-loading">

js:

 $("#input-700").fileinput({
uploadUrl: "upload.php",
uploadAsync: true,
maxFileCount: 10});

upload.php:

echo "test";

if (empty($_FILES['input-700'])) {
echo json_encode(['error'=>'No files found for upload.']); 
return; 
}

// get the files posted
$images = $_FILES['input-700'];
var_dump($images);

More strange: when i delete echo(test); i get the error: No files found for upload

Thanks for your support

if you have another solution , i shall be glad to get it..

Share Improve this question asked Feb 28, 2015 at 10:20 user2802283user2802283 991 gold badge4 silver badges7 bronze badges 1
  • hi kindly refer to this link mine works well with this stackoverflow./questions/29626410/… – fritz Commented Sep 4, 2017 at 7:16
Add a ment  | 

1 Answer 1

Reset to default 2

Since you have set the uploadUrl parameter you are using the ajax uploads feature (instead of native HTML form submission).

You need to ensure that you return a proper JSON encoded data response from the server action (as set in uploadUrl) else the plugin fails. You can read the plugin documentation for ajax uploads where this is highlighted. For example, even if you do not have any data to send - you can send a empty JSON string like {}.

First , i am a french web developer ( sorry for my poor english )

i 'am looking for a bootstrap php image upload with thumbnail.

i would like to make an upload image file like :

[/][1]

the Krajee plugin ([][2]) seems to be the one i am looking for..

But i have some problems with the upload..

i get the error message:

item1.png: SyntaxError: Unexpected token e

my form:

   <input id="input-700" name="kartik-input-700" type="file" multiple=true class="file-loading">

js:

 $("#input-700").fileinput({
uploadUrl: "upload.php",
uploadAsync: true,
maxFileCount: 10});

upload.php:

echo "test";

if (empty($_FILES['input-700'])) {
echo json_encode(['error'=>'No files found for upload.']); 
return; 
}

// get the files posted
$images = $_FILES['input-700'];
var_dump($images);

More strange: when i delete echo(test); i get the error: No files found for upload

Thanks for your support

if you have another solution , i shall be glad to get it..

First , i am a french web developer ( sorry for my poor english )

i 'am looking for a bootstrap php image upload with thumbnail.

i would like to make an upload image file like :

[http://www.2ememain.be/inserer/][1]

the Krajee plugin ([http://plugins.krajee./file-input][2]) seems to be the one i am looking for..

But i have some problems with the upload..

i get the error message:

item1.png: SyntaxError: Unexpected token e

my form:

   <input id="input-700" name="kartik-input-700" type="file" multiple=true class="file-loading">

js:

 $("#input-700").fileinput({
uploadUrl: "upload.php",
uploadAsync: true,
maxFileCount: 10});

upload.php:

echo "test";

if (empty($_FILES['input-700'])) {
echo json_encode(['error'=>'No files found for upload.']); 
return; 
}

// get the files posted
$images = $_FILES['input-700'];
var_dump($images);

More strange: when i delete echo(test); i get the error: No files found for upload

Thanks for your support

if you have another solution , i shall be glad to get it..

Share Improve this question asked Feb 28, 2015 at 10:20 user2802283user2802283 991 gold badge4 silver badges7 bronze badges 1
  • hi kindly refer to this link mine works well with this stackoverflow./questions/29626410/… – fritz Commented Sep 4, 2017 at 7:16
Add a ment  | 

1 Answer 1

Reset to default 2

Since you have set the uploadUrl parameter you are using the ajax uploads feature (instead of native HTML form submission).

You need to ensure that you return a proper JSON encoded data response from the server action (as set in uploadUrl) else the plugin fails. You can read the plugin documentation for ajax uploads where this is highlighted. For example, even if you do not have any data to send - you can send a empty JSON string like {}.

本文标签: javascriptkrajee bootstrap file input uploadStack Overflow