1

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);
}
});

screenshot screenshot screenshot

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.

  • There is no fid column in field_data_field_name because it's not a file. How do you add that image to the DB? – GwenM Dec 22 '15 at 13:22
  • Apologies; I forgot to mention that I'm using services, and I used Tyler Frankenstein's guide to create a node. I first query file.json, get back fid, and then query create.json to write the fid to the appropriate field. UPDATE: I've just checked, and there actually is a field_data_field_name_fid column in that table. – Kartagis Dec 22 '15 at 13:27
0

Kartagis: it is about your operational environments. You should focus on checking the environments' configurations. Try copy the configurations of working server and enhance the working server if it is not accepting large images ( for example in your php.ini play with settings).

| improve this answer | |
  • Actually, it is accepting images and inserting their fid's into {file_managed} and {file_usage}. However, it's not inserting into {field_data_field_name} – Kartagis Jun 29 '16 at 3:38
0

There was a regression in Drupal 7.43 that caused problems with file uploads in some use cases. It was first noticed in Webform, and the fix to core was not included in the 7.44 release the other day.

| improve this answer | |
  • But, the file can be uploaded just fine. Its fid is not written to field_data_field_name. – Kartagis Jun 23 '16 at 3:39
  • Also, the site is on 7.41 – Kartagis Jun 23 '16 at 3:41
  • I've just tried updating the core and applying the patch, didn't work :( – Kartagis Jun 23 '16 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.