localhost/test/fileprogram/ajax/checkfile.php
result is: C:/xampp/htdocs

Sorry it's taking a while to get there. Can you confirm this folder?

C:\xampp\htdocs\test\fileprogram\assets\files

yes thats correct

It's untested code, but your ajax file C:\xampp\htdocs\test\fileprogram\ajax\checkfile.php should now be this:-

<?php 
    echo file_exists($_SERVER['DOCUMENT_ROOT'].'/test/fileprogram/assets/files/'.$_GET['filename']) ? json_encode(array(1)) : json_encode(array(0));
?>

and called like this:-

localhost/test/fileprogram/ajax/check-file.php?filename=image25.jpg

first without the file being present, and then again, with the filename being present.

results for checkfile.php only is:
Notice: Undefined index: filename in C:\xampp\htdocs\test\fileprogram\ajax\checkfile.php on line 2 [1]

localhost/test/fileprogram/ajax/checkfile.php?filename=image25.jpg
result: [1]

Sorry. I should have said "First, without the file being present, and then again with the file being present".

Sorry.

@paulkd

first w/out file
Notice: Undefined index: filepage in C:\xampp\htdocs\test\fileprogram\ajax\checkfile.php on line 2 [0]

with file
Notice: Undefined index: filepage in C:\xampp\htdocs\test\fileprogram\ajax\checkfile.php on line 2 [0]

thanks

We agreed "filename", so your call should be

localhost/test/fileprogram/ajax/check-file.php?filename=image25.jpg

hi paulkd, sorry was busy in other script related to this, working in parallel, however i did tried to use the 'filename' again and results to:

the image25.jpg file NOT in folder:

localhost/test/filecms_v0_9/ajax/checkfile.php

Result:
Notice: Undefined index: filename in
C:\xampp\htdocs\test\fileprogram\ajax\checkfile.php on line 2 [1]

localhost/test/filecms_v0_9/ajax/checkfile.php?filename=image25.jpg

Result
[0]

the image25.jpg file IN the folder:

localhost/test/filecms_v0_9/ajax/checkfile.php

Result:
Notice: Undefined index: filename in
C:\xampp\htdocs\test\fileprogram\ajax\checkfile.php on line 2 [1]

localhost/test/filecms_v0_9/ajax/checkfile.php?filename=image25.jpg

Result
[1]

Hi kanoy83.

This is very odd indeed.
We are seeing the correct results.
But your error message references a physical path that your web address is not using - ...test\fileprogram\ajax and ...test/filecms_v0_9/ajax

hi paulkd,

sorry this filecms_v0_9 is the same with fileprogram, please disregard the filecms_v0_9

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.