Closed ghost closed 12 years ago
Have you look your php error log ?
jorji reply@reply.github.com a écrit :
Hi! I've upgraded to the latest version. It's really better - I like the new way of the forms, it's a way better solution.
But I have a trouble with the upload process now - it doesn't return the file name and folder.
The file is being processed as it appears in the upload folder but jquery doesn't return any reponse, thus the picture hidden field can't get proper value. I'm kinda stuck at this point :|
Reply to this email directly or view it on GitHub: https://github.com/ruian/RuianUploadifyBundle/issues/3
hmm are you sure that you've give right copy and preview params ?
maybe you end your folder param with a '/' and when i concat folder + filename it wrong because in the js part i add the '/'
The error log is empty. Uploadify doesn't return anything at all.
I added:
onComplete : function(event, ID, fileObj, response, data) {
response = JSON.parse(response);
console.log(response);
$('#{{ attr['data-preview'] }}').html("<img src='"+response.folder+'/'+response.file+"' />");
$('#{{ attr['data-copy'] }}').attr('val', response.folder+response.file);
},
onError : function (event,ID,fileObj,errorObj) {
console.log(errorObj.type + ' Error: ' + errorObj.info);
},
onSelect : function(event,ID,fileObj) {
console.log('The file ' + fileObj.name + ' was added to the queue.');
}
to see what is returned and the only log it's being triggered is that the file is being uploaded.
Will dig for more info, perhaps is js problem.
You can make a console.log(response) in the oncomplete event like this you will see if you are getting errors
jorji reply@reply.github.com a écrit :
The error log is empty. Uploadify doesn't return anything at all.
I added:
onComplete : function(event, ID, fileObj, response, data) { response = JSON.parse(response); $('#{{ attr['data-preview'] }}').html("<img src='"+response.folder+'/'+response.file+"' />"); $('#{{ attr['data-copy'] }}').attr('val', response.folder+response.file); }, onError : function (event,ID,fileObj,errorObj) { console.log(errorObj.type + ' Error: ' + errorObj.info); }, onSelect : function(event,ID,fileObj) { console.log('The file ' + fileObj.name + ' was added to the queue.'); }
to see what is returned and the only log it's being triggered is that the file is being uploaded.
Will dig for more info, perhaps is js problem.
Reply to this email directly or view it on GitHub: https://github.com/ruian/RuianUploadifyBundle/issues/3#issuecomment-3885774
Got it working :) replaced: response = JSON.parse(response); with: response = jQuery.parseJSON(response);
hmm strange because thid json.parse is ok with me :-). but maybe it's better to use jquery one. do you want to make a PR ?
I checked http://api.jquery.com/jQuery.parseJSON/ And yes it was working in the previous release. Perahps it's isulated problem with because I've got some other jQ plugins and maybe they are causing troubles.
P.S It's missing one file: /img/cancel.png
Noticed this: $('#{{ attr['data-copy'] }}').attr('val', response.folder+response.file);
Should be: $('#{{ attr['data-copy'] }}').attr('value', response.folder+response.file);
And perhaps this line: <img src='"+response.folder+'/'+response.file+"
it's better to be <img src='"+response.folder+response.file+"
and in the configuration
'data' => array(
'folder' => '/uploads/thumbnails',
'preview' => 'preview',
'path' => 'uploadify',
'copy' => $this->getName() . '_' . 'thumbnail'
),
to become
'data' => array(
'folder' => '/uploads/thumbnails/',
'preview' => 'preview',
'path' => 'uploadify',
'copy' => $this->getName() . '_' . 'thumbnail'
),
The reason is that the file is saved in the database as /folderfilename.jpg (missing the slash /folder/filename.jpg)
i updated the code. but i'm with my phone so i can't add files to the repo. when i will come back i will add them. thx for your help :-)
I just added the img folder with cancel.png
Hi! I've upgraded to the latest version. It's really better - I like the new way of the forms, it's a way better solution.
But I have a trouble with the upload process now - it doesn't return the file name and folder.
The file is being processed as it appears in the upload folder but jquery doesn't return any reponse, thus the picture hidden field can't get proper value. I'm kinda stuck at this point :|