I've got this weird problem. I've been developing this phonegap app and it's in the testing phase now, and this is where the nightmare begins. I am able to successfully upload images encoded as base64 strings, retrieve their fid and save them to database. Please see the below screenshot. However, it's like the fid is not associated with the nid. EDIT: I've just looked again, and there is no trace of the fid in question in field_data_field_name. UPDATE: The weird thing is, I have two image fields of which one works fine. EDIT: I and another fellow have the replicate of this website, and this works on the other server just fine.
UPDATE: My code:
$.ajax({
url:'http://www.rejicast.com/services/file.json',
type:'post',
dataType:'json',
data:fileData,
success:function(res) {
var fid = '';
$.each(fids, function(k,v) {
fid += '&node[field_fotograflar][und]['+k+'][fid]='+v;
});
var cat = '';
$('#oyuncuKategori input:checked').each(function(k,v) {
cat += '&node[field_kategorisi][und]['+k+']='+$(this).attr('id');
});
$.ajax({
url:'http://www.rejicast.com/services/node.json',
type:'post',
dataType:'json',
data:'node[type]=oyuncu&node[field_oyuncu_fotografi][und][0][fid]='+res.fid+'&node[field_oyuncu_fotografi][und][0][cropbox_x]=0&node[field_oyuncu_fotografi][und][0][cropbox_y]=0&node[field_oyuncu_fotografi][und][0][cropbox_height]=800&node[field_oyuncu_fotografi][und][0][cropbox_width]=600&node[title]='+encodeURIComponent($("#name").val())+'&node[language]=und&node[field_tc_kimlik_no][und][0][value]='+encodeURIComponent($("#tckn").val())+'&node[field_sgk_durumu][und][value]='+encodeURIComponent($("#sgk option:selected").val())+'&node[field_telefon][und][0][value]='+encodeURIComponent($("#tel").val())+'&node[field_telefon_2][und][0][value]='+encodeURIComponent($("#tel2").val())+'&node[field_adres][und][0][value]='+encodeURIComponent($("#address").val())+'&node[field_yasadigi_sehir][und][value]='+encodeURIComponent($("#city option:selected").val())+'&node[field_e_posta][und][0][value]='+encodeURIComponent($("#email").val())+'&node[field_cinsiyet][und][value]='+encodeURIComponent($("#gender option:selected").val())+cat+'&node[field_gogus][und][value]='+$("#chest option:selected").val()+'&node[field_bel][und][value]='+$("#waist option:selected").val()+'&node[field_kalca][und][value]='+$("#thigh option:selected").val()+'&node[field_dogum_tarihi][und][0][value][date]='+finalDate+'&node[field_boy][und][value]='+encodeURIComponent($("#height option:checked").val())+'&node[field_kilo][und][value]='+encodeURIComponent($("#weight option:selected").val())+'&node[field_goz_rengi][und][value]='+encodeURIComponent($("#eyecolour option:selected").val())+'&node[field_ten_rengi][und][value]='+encodeURIComponent($("#skincolour option:selected").val())+'&node[field_ayak_no][und][value]='+encodeURIComponent($("#shoesize option:selected").val())+'&node[field_egitim_duzeyi][und][value]='+encodeURIComponent($("#education option:selected").val())+'&node[field_oyunculuk_egitimleri][und][0][value]='+encodeURIComponent($("#training").val())+'&node[field_diller][und][0][value]='+encodeURIComponent($("#languages").val())+'&node[field_beceriler][und][0][value]='+encodeURIComponent($("#skills").val())+'&node[field_kisisel][und][0][value]='+encodeURIComponent($("#personal").val())+fid+'&node[field_videolar][und][0][video_url]='+encodeURIComponent($(".videolink").val())+'&node[field_videolar][und][0][description]='+encodeURIComponent($(".videodesc").val())+'&node[field_okudum_anladim][und][value]='+encodeURIComponent($(".privacy").is(':selected')?1:0),
success:function(data) {
ActivityIndicator.hide();
navigator.notification.alert("Kaydınız başarıyla yapıldı", function() {return;}, "Face in Cast", "Tamam");
window.location.href = "received.html";
},
error:function(xhr,status,message) {
ActivityIndicator.hide();
navigator.notification.alert("Eksik bırakılan alan var, lütfen doldurup tekrar deneyin.", function(){return;}, "Hata", "Tamam");
}
});
},
error:function(xhr,status,message) {
console.log(xhr);
console.log(status);
console.log(message);
}
});
As you can see in the first screenshot, the fid is sent along with the node. The second one says the fid is there (dblog), but the third one says it's not (devel). Also, directly querying the database says it's not in the field_data_field_name, but it is in file_managed.
Sorry for the discrepancies in fids between images. This problem is too old and it recently started happening again.
file.json
, get back fid, and then querycreate.json
to write the fid to the appropriate field. UPDATE: I've just checked, and there actually is afield_data_field_name_fid
column in that table.