View Full Version : File uploading problem in PHP with AJAX

Jul 10th, 2007, 10:40 AM

Im trying to upload file using copy() in PHP. Here i couldn't get $_POST["cntrlName"]["tmp_name"] and $_POST["cntrlName"]["name"] if its in PHP with AJAX. But its working properly if i submit any page to PHP page. How to get "tmp_name" and "name" using PHP and AJAX ?

Sep 17th, 2007, 10:32 AM
Firstly you need to understand PHP. PHP only calculates the size/mime-type etc after the file is uploaded to a temp directory. You cannot force ajax to use a php function on a file that doesn't exist. My advice would be, copy the file via PHP without using AJAX, then use AJAX to get the information, and calculate whatever you like.

Also It would help if you posted your code so we can see where its going wrong.