-
28 Dec 2007 5:23 AM #1
Ext.ux.UploadDialog not post the filename
Ext.ux.UploadDialog not post the filename
Hello,
I am using the uploaddialog from Maxim Bazhenov
PHP Code:this.dlg = new Ext.ux.UploadDialog.Dialog(null, {
autoCreate: true,
closable: false,
collapsible: false,
draggable: true,
minWidth: 400,
minHeight: 200,
modal:true,
width: 400,
height: 350,
proxyDrag: true,
resizable: false,
constraintoviewport: true,
title: 'Upload',
url: 'upload.php?reqaction=uploadfile&resptype=json',
reset_on_hide: false,
allow_close_on_upload: true,
upload_autostart: false,
permitted_extensions: ["txt"]
});
PHP Code:<?php
$uploaddir = 'files/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
$response = array();
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
$response['success'] = true;
$response['message'] = 'File uploaded successfully';
}
else {
$response['success'] = false;
$response['message'] = 'Some error occurred during file upload';
}
echo json_encode($response);
?>
I can show the upload dialog , browse to a file. But when i tried to access the $_FILES['file'], it gives me an error. I can see it in Firebug
Can you check my code ?
Do you have some examples ?
thanks
Olivier
-
28 Dec 2007 9:02 AM #2
What error do you see in the Firebug exactly?
Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
30 Dec 2007 8:54 AM #3
I can see in firebug that the uploaddialog is doing the request but no data in POST
When i try to access $_FILES in php the array is empty.
In firebug, i see that my php code is returning an error that the $_FILEs is not defined.
THanks
Olivier
-
30 Dec 2007 10:46 AM #4
PHP Version?
OS Version?
Do you have file_uploads = On in php.ini?
Do you have upload_tmp_dir set in php.ini?
What permissions are set on upload directory?
Also try to use base_params config option for sending query parameters like "reqaction=uploadfile&resptype=json"Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
2 Jan 2008 3:11 AM #5
I am using PHP 5.2.0
The tmp dir is ok, i have a simple upload in HTML and it works
using the base_params doesnt pass the parameters.
-
2 Jan 2008 3:12 AM #6
Can you copy a simple syntax how to pass the params via base_params ?
thanks
Olivier
-
2 Jan 2008 4:23 AM #7
Also you can set base_params with setBaseParams() method.Code:dialog = new Ext.ux.UploadDialog.Dialog(null, { autoCreate: true, closable: true, collapsible: false, draggable: true, minWidth: 400, minHeight: 200, width: 400, height: 350, proxyDrag: true, resizable: true, constraintoviewport: true, title: 'File upload queue.', url: 'upload-dialog-request.php', reset_on_hide: false, allow_close_on_upload: true, upload_autostart: true, base_params: { reqaction: 'uploadfile', resptype: 'json' } });Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
2 Jan 2008 8:04 AM #8
I added the code but i still cannot see the params
Can you send me again the URL with the latest code ?
Just to make sure.
thanks
Olivier
-
2 Jan 2008 8:44 AM #9
For ExtJS 1.x
http://max-bazhenov.com/dev/upload-d...loadDialog.zip
For ExtJS 2.x
http://max-bazhenov.com/dev/upload-d...loadDialog.zip
Can you give me a link to a page where you use the extension and ftp access? Then I can check both server side and client side code and point you where the error is..Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
2 Jan 2008 11:55 PM #10
Maxim,
Now it is working. I was not returning the correct JSON string.
Now it is ok and i can access $_FILES
THanks for your help
Olivier


Reply With Quote