this is the same issue of https://toolset.com/forums/topic/validate-file-data-structure-on-upload-cred_form_ajax_upload_validate/
I just couldn't add this comment and reopen the topic.
Hi Lou.
I have run this code as you suggested and asked my team to look into this as well. we all get the same issue.
we don't get the full path as you did in your screenshot above.
see attached 'file path issue.jpg' .
The "temp_name" string is not complete and does not include the full URL.
Also, I see that in your screenshot the file is extension is tmp and not the actual file extension and the name is a random name.
Our goal is to validate file extension and structure of excel, csv and txt files. we can do the extension validation just fine.
Once the extension is validated we are trying (in the same function) to read the file and validate its structure. it seems that are having some issue with reading the file as we don't get the actual path and file extension.
I'm trying to understand if the temp file with the temp name and .tmp extension is readable or not. Is the tmp folder in the path is virtual? i.e. is it been created in the virtual memory of the server. I ask this as I couldn't find the tmp folder on the server.
Step 1 - 1b of our process works fine:
1. Validate file extension is correct (using : cred_form_ajax_upload_validate)
1a. if error - deny upload, ask user to upload file with acceptable file extension.
1b. if no error - go to step 2
the next step is not successful (within the same function)
2. get file path and validate file data structure
I believe we cannot get the file path as the
return array( $fields, $errors );
is not returned yet.
the next two sub steps are depended on the previous step
2a. if error - deny upload, ask user to correct the file data structure and try again (go to step 1 on ne upload).
2b. in no error - accept the file and continue to the form (so user can complete the form submitting)
I noticed that if we don't go to step 2 within the same function and the upload is successful we can get the file absolute path. see file 'path issue 2.jpg' image
BTW
when I us the var_dump($fields); in the function I always get an error even if the file extension is correct. see 'file path issue 3 - with var-dump.jpg'.
Any advice on this will be appreciated.
Thanks,
David