Check file exist or not in PHP -


इस सवाल का पहले से ही एक उत्तर है: < / P>

  • 2 जवाब

    मैं जांचना चाहूंगा फ़ाइल मौजूद है या नहीं और एक परिभाषित छवि प्रदर्शित मैं नीचे कोड का उपयोग करने की कोशिश करता हूं यह हमेशा no.png प्रदर्शित करता है, केवल 1111.pdf भी मौजूद है! <पूर्व> $ fileUrl = "http: //localhost/Report/1111.pdf"; $ AgetHeaders = @get_headers ($ sourcePath); अगर (preg_match ("| 200 |", $ AgetHeaders [0])) {// फ़ाइल मौजूद है गूंज "& lt; img src = 'http: //localhost/Report/yes.png'>"; } और {// फ़ाइल मौजूद नहीं है "गूंज; & lt; img src = 'http: //localhost/Report/no.png'>"; }

    क्या आपने इसे googling का प्रयास किया?

    फ़ाइल_एक्सिस्ट

    file_exists एक ???? = '/path/to/foo.txt'; अगर (file_exists ($ filename)) {गूंजती "फ़ाइल $ फ़ाइलनाम मौजूद है"; } Else {गूंजती "फाइल $ फाइलनाम मौजूद नहीं है"; }? & Gt;

Comments

Popular posts from this blog

sonata admin - how to add ManyToOne property field in configureListfield in sonataAdmin -

wpf - ControlTemplate with changes for every class -

sql - Return Function using Cursor -