-
20 Sep 2007 1:55 PM #51
Thanks MaximGB I will have a look, sorry if this is elementary but I am just finding my way and appreciate the help.
-
21 Sep 2007 5:33 AM #52
Hi Maxim;
Do you have a zip of full project to assist in my learning curve, I am new to this and eager to learn.
I know some are sensitive about being asked to supply their hard work so if this applies to you then let me know and I will trudge along through the forum until I can pull together a working example that I can build on.
Starting from a blank sheet may be to steep for me at this time.
Thanks for your help.
SC
-
21 Sep 2007 1:19 PM #53
Hi southside
Yes I do
, now it contains 1391 files in 258 folders, and I guess it won't help you.
No I am not such a sensitive, but I don't understand you request, if you need examples use extjs's examples that go with distribution. If you have questions ask them here or at other forums devoted to those technologies you have questions in.
"This is the talk for the poor peoples sake". If you have questions for which you can't find answers in the docs, books, net, then you should ask those questions.Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
25 Sep 2007 7:56 AM #54
Hi Maxim;
I have managed to get the files saving to my server location using your upload system.
I see threads about a response cannot be sent back from a php upload page.
Your code below is in a php page and sends an OK back to the dialog I assume.
I have tried to do the same in my php page and had no message returned to the dialog.
If I use your code in your upload-dialog-request.php I get the OK.
So my JSON I guess is running fine - my server is PHP 4.3.9 with json 1.2.1.
Can you help, I just need to know how to tell my php page to send th OK on success?
I thought I could just use the "echo json_encode($response);" element and have $response = whatever?
<?php
$response = array(
'success' => true
);
echo json_encode($response);
?>
-
25 Sep 2007 11:11 AM #55
You should return a json-message in following format:
There is only one required member in this message, it's 'success' flag.Code:{ success: true of false, error: 'String with error or message, with member also can be named message', ... any other your code private data ... }
Using php the message creation code should be like this:
I advise you to install Firefox with Firebug plugin (if you still haven't done it) and see what json-message your code is actualy returning.Code:$response = array(); if ($file_uploaded) { $response['success'] = true; $response['message'] = 'File uploaded successfully'; else { $response['success'] = false; $response['message'] = 'Some error occurred during file upload'; } echo json_encode($response);Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
26 Sep 2007 3:01 AM #56
Maxim;
I think I see, I am a bit unsure though.
Say I am using the basic php upload file like below, this uploads the file but i obviously get no response back via json. (Ps I am using firebug to watch for response from your dialog upload utility).
When I try and enter the response code into the php upload your dialog upload returns an error and does not upload the file eg I get a red cross.
So I guess i am doing it wrong can you advise how the response should be placed in the simple php upload file.
Once I get the idea I will be able to work adding to it out myself.
Hope you can help.
SC
<?php
$uploaddir = 'files/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
-
26 Sep 2007 7:38 AM #57
Hi Maxim;
I have just managed to get it working using your code snippett as the basis.
This returns "File uploaded successfully" into your dialog NOTES BOX, which is what I was trying to do.
Is this correct.
<?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);
?>
-
26 Sep 2007 11:32 AM #58
Yes it is.
Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
26 Sep 2007 5:52 PM #59Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
Great job! I'm going to see if i can plug this into a back end for a client.
I got sick of using SWF Upload.
I was able to implement something like (dev): http://screencast.com/t/i2Hv2SC6
But when i went to deploy it in production i had HTTP 403s being reported by SWF Uploader. HTML Forms worked great for the upload form, but SWF uploader just would NOT work w/ this web server. Sooo strange.
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
26 Sep 2007 8:10 PM #60
Extention case
Extention case
Awesome ux.
Just found a small logic fix. Seems that the permitted_extensions does not take case into consideration. So 'jpg' is not the same as 'JPG' depending how it is named on the user's machine. Simply solved it by defining my allowed extensions in lower case and added the "toLowerCase" as below:
PHP Code:getFileExtension : function(filename)
{
var parts = filename.split('.');
if (parts.length == 1) {
return null;
}
else {
return parts.pop().toLowerCase();
}
}


Reply With Quote