Sorun php bir dosyayı yükleyerek. -

2 Cevap php

Ben bazı gerçekten garip sorun yaşıyorum Peki, bu ne olur:

This is the environment: I have a modal panel that has to be able to hold several "steps", first you have to upload a file, then the file is processed and from this processing result, I have to generate some html to fill the next step.

This is what I do: I'm uploading a file within a modal panel's form in either one of two ways (from some url, or from your local hard drive using the file type input and $_FILES), using jquery's $.ajaxForm to submit it to the php file that processes it. Once processed, I have all the objects that I need filled with info, that are used in some template that I include and then with it's contents filled into a text variable I json_encode them in order to be appended into my modal panel's second form.

So far... so good... until I found out that when I choose "from url" and disable file input, everything works just fine, but when I enable the file input upload, the result html that I get from the include from the template is broken (yeah... you must be saying WTF?, but is true 0_0 I tryed EVERYTHING until I isolated where the error was hiding...). It get some "PRE" html tag added at the beggining of the html result and every tag is cast to upper case and all ending tags have its "<" and ">" replaced by it's entity counterpart (like & lt; and so). I saw that by "alerting" the raw HTML result in the form's callback (and obviously by the damage caused to the result form). Any ideas about what can be happening??

Şimdiden teşekkürler!

PS: Ben ayrıntılı var ...: P

2 Cevap

Sorun nerede bulunuyor gibi geliyor çünkü muhtemelen, kullandığınız framework / çiftleşmiş motoru hakkında biraz detay vermek gerekir. Olasılıkla enctype="multipart/form-data" dosya yüklemeleri için kullanmak zorunda - formun dosya giriş sürümü hakkında bir şey gibi görünüyor bu delirtiyor. Size olmayan dosya iletişim için enctype niteliği ekleyerek ve çok sonra deli giderse görerek o kısmını test edebilir.

Lütfen çiftleşmiş motoru sorumlu ise, sorunu gidermekle muhtemelen onu yükseltme ya da cesareti hata ayıklama ya içerecektir.

Bildiğim kadarıyla, böyle ajax ile bir upload sunamazlar. Bir <iframe> içinde bir form oluşturarak ve ardından göndererek sahte olabilir, ama ben bunu yapmak için saf ajax kullanmak sanmıyorum. Ben bir prototip kullanıcı değilim, ama think aynı jquery veya başka herhangi bir kütüphane için geçerlidir.