Hello,
I tried to use kendo upload and that works but I get a error message when upload finish.
Kendo upload does everything right and at the end the file was uploaded but kendo upload says that it had a problem.
I know that in Save file if response is empty means the process was good otherwise the process had a problem.
I think the problem is caused because of response of apache, it says that My Content-Length = 2 but really My response was empty.
I took this examples from kendo examples
This is the raw view of the response of my web server:
HTTP/1.1 200 OK
Date: Tue, 17 Apr 2012 06:31:58 GMT
Server: Apache/2.2.21 (Win32) PHP/5.3.8
X-Powered-By: PHP/5.3.8
Content-Length: 2
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html
Code html/js:
code save.php:
code remove.php:
Is there a way to configure kendo upload to understand another answer than empty? For example a JSon like {Status:0}
Thank you,
Daniel Botero Correa
I tried to use kendo upload and that works but I get a error message when upload finish.
Kendo upload does everything right and at the end the file was uploaded but kendo upload says that it had a problem.
I know that in Save file if response is empty means the process was good otherwise the process had a problem.
I think the problem is caused because of response of apache, it says that My Content-Length = 2 but really My response was empty.
I took this examples from kendo examples
This is the raw view of the response of my web server:
HTTP/1.1 200 OK
Date: Tue, 17 Apr 2012 06:31:58 GMT
Server: Apache/2.2.21 (Win32) PHP/5.3.8
X-Powered-By: PHP/5.3.8
Content-Length: 2
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html
Code html/js:
<
div
id
=
"example"
class
=
"k-content"
>
<
div
style
=
"width:60%"
>
<
input
name
=
"files[]"
id
=
"files"
type
=
"file"
/>
</
div
>
</
div
>
<
script
>
$(document).ready(function() {
$("#files").kendoUpload({
async: {
saveUrl: 'save.php',
removeUrl: 'remove.php',
autoUpload: true
}
});
});
</
script
>
code save.php:
<?php
$fileParam
=
"files"
;
$uploadRoot
=
"c:/upload/"
;
$files
=
$_FILES
[
$fileParam
];
if
(!
is_dir
(
$uploadRoot
))
{
mkdir
(
$uploadRoot
, 0777, true);
chmod
(
$uploadRoot
, 0777);
}
if
(isset(
$files
[
'name'
]))
{
foreach
(
$files
[
"name"
]
as
$i
=>
$name
) {
$error
=
$files
[
'error'
][
$i
];
if
(
$error
== UPLOAD_ERR_OK) {
$targetPath
=
$uploadRoot
.
basename
(
$files
[
"name"
][
$i
]);
$uploadedFile
=
$files
[
"tmp_name"
][
$i
];
if
(
is_uploaded_file
(
$uploadedFile
)) {
if
(!move_uploaded_file(
$uploadedFile
,
$targetPath
)) {
echo
"Error moving uploaded file"
;
}
}
}
else
{
echo
"Error code "
.
$error
;
}
}
}
// Return an empty string to signify success
echo
""
;
?>
code remove.php:
<?php
$fileParam
=
"files"
;
$uploadRoot
=
"c:/upload/
"
;
$fileNames
=
$_POST
[
"fileNames"
];
if
(isset(
$fileNames
))
{
foreach
(
$fileNames
as
$i
=>
$name
) {
$targetPath
=
$uploadRoot
.
basename
(
$name
);
if
(!unlink(
$targetPath
)) {
echo
"Error removing file"
;
}
}
}
// Return an empty string to signify success
echo
""
;
?>
Is there a way to configure kendo upload to understand another answer than empty? For example a JSon like {Status:0}
Thank you,
Daniel Botero Correa